$\log_3 0$ is not defined.
$\log_3 K$ can only make sense if $K >0$. $K \le 0$ makes no sense.
When you went from $\log_3 x=\frac {1}{2}\log_3 3x$ (it is assumed $x, 3x > 0$) to the implied step
$3^{\log_3 x} = 3^{\frac 12\log_3 3x}$ (still assumed $x,3x > 0$) to
$x = \sqrt{3x}$ we lost the assumption that $x, 3x > 0$ and instead only have the assumption $x , 3x \ge 0$.
And when you squared both sides $x^2 = 3x$ you lost the assumption that $x, 3x \ge 0$ (but that didn't lead to any error).
So you get two possible solutions $x =0$ or $x =3$. But only $x = 3$ satisfies our lost assumption that $x > 0$.
.....
$x=0$ is called an extraneous solution. They sneak up on you and you have to watch out for them.
They happen when STEP A $\implies$ STEP B, but STEP B $\not \implies$ STEP A.
In this case $\log_3 a = \log_3 b \implies a=b$ but $a=b \not \implies \log_3 a = \log_3 b$ because it's possible that $a,b$ might be $0$ or negative.
....
The most common error is when squaring both sides.
For example: Suppose $\sqrt{2x+3} = x$ solve for $x$.
Notice $x \ge 0$ is assumed.
Now when we solve this we square both sides $\sqrt{2x+3} = x\implies 2x+3 =x^2$. (Notice we lost the assumption $x \ge 0$!!!!!) So $x^2 - 2x-3 = 0$ and $(x-3)(x+1) = 0$ so $x =3$ or $x=-1$. Well, $x =-1$ isn't possible because $\sqrt {2(-1)+3}=\sqrt 1 \ne{-1}$!
Note: $\sqrt{a} = b\implies a = b^2$ but $a=b^2 \not \implies \sqrt a = b$ as $b$ could be negative.