Why do I get two different results for the reciprocal of $i$?

I am aware that the correct answer is
$$\frac{1}{i}=\frac{1}{i}\frac{i}{i}=\frac{i}{i^2}=\frac{i}{-1}=-i$$
But equally, I find no error here:
$$\frac{1}{i}=\frac{1}{\sqrt{-1}}=
\frac{\sqrt{1^2}}{\sqrt{-1}}=\frac{\sqrt{1}}{\sqrt{-1}}
=\sqrt{\frac{1}{-1}}=\sqrt{-1}=i$$
someone could tell me why it is not valid?

Solutions Collecting From Web of "Why do I get two different results for the reciprocal of $i$?"

As people are saying, you can’t rely on $\sqrt a\sqrt b=\sqrt{ab}$ in $\Bbb C$. The most common branch cut (I believe) to take is over the negative real axis, so $\sqrt{z} = |z|^{1/2}e^{i \theta /2}$, where $\theta \in (-\pi, \pi]$. If you multiply two numbers together, then the arguments add, so you may get
$$wz = |w||z|e^{i(\phi + \theta)}$$
but then you change $\phi + \theta$ so that $\phi + \theta \in (-\pi, \pi]$; this may not need to be done if $\phi/2 + \theta/2 \in (-\pi, \pi]$. Eg, $\theta = {3 \over 2}\pi = \phi:$ $\phi + \theta = 3\pi = \pi + 2\pi$ but $\phi/2 + \theta/2 = {3 \over 2}\pi$. Let $|w| = |z| = 1$. We then have
$$\sqrt{wz} = \sqrt{e^{i(\phi + \theta)}} = \sqrt{e^{i(\pi+2\pi})} = \sqrt{e^{i\pi}} = e^{i\pi/2} \ \ (= 1),
\\
\sqrt{w}\sqrt{z} = \sqrt{e^{i\phi}}\sqrt{e^{i\theta}} = {e^{i\phi/2}}{e^{i\theta/2}} = e^{i(\phi/2 + \theta/2)} = e^{i3\pi/2} \ \ (=-1).$$

You cannot rely on $\sqrt a\sqrt b=\sqrt{ab}$ in the world of $\mathbb C$.

Square root is a “multi-valued function” when it comes to complex numbers. If you choose a particular branch of the square root, you have to modify identities such as $\sqrt{a/b} = \sqrt{a}/\sqrt{b}$.