Which step is wrong in this proof 
Proof: Consider the quadratic equation $x^2+x+1=0$. Then, we can see that $x^2=−x−1$. Assuming that $x$ is not zero (which it clearly isn't, from the equation) we can divide by $x$ to give
  $$x=−1−\frac{1}{x}$$
  Substitute this back into the $x$ term in the middle of the original equation, so
  $$x^2+(−1−\frac{1}{x})+1=0$$
  This reduces to
  $$x^2=\frac{1}{x}$$
  So, $x^3=1$, so $x=1$ is the solution. Substituting back into the equation for $x$ gives
  $1^2+1+1=0$
  Therefore, $3=0$. 

What happened?
 A: Up to $x^3=1$ everything is fine. This allows you to conclude that $x\in \{z\in \Bbb C\colon z^3=1\}$. Since $\{z\in \Bbb C\colon z^3=1\}=\left\{\dfrac{-1 + i\sqrt 3}{2}, \dfrac{-1 - i\sqrt 3}{2},1\right\}$, then $x$ is one of the elements of this set.
You made a reasoning consisting of logical consequences, not one of logical equivalences. That's why you can tell that $x\in \{z\in \Bbb C\colon z^3=1\}$, but you can't say which one is it.
See this for a similar issue.
An even more simpler version of your mistake is this: suppose $x^2=1$, then $x=1$.
You can convince yourself that this is wrong and that you did the same thing in your question.
A: What you have proved is that there is no real number $x$ such that $x^2+x+1=0$.
On the other hand, the two complex solutions of $x^2+x+1=0$ do indeed satisfy $x^3=1$.
A: if $x^2+x+1=0$ then $(x-1)(x^2+x+1)=0$ thus $x^3-1=0$, thus: $x^3=1$.
if  ...  then ....  is  not a logical equivalence but only  a logical implication.
A: $x^2+x+1=0$ is a quadratic. This means it has two answers.
$x^3=1$ is a cubic. This means it has three answers. Therefore if you solve for $x$, then one of the answers you get won't fit the original equation.
This "extraneous" solution just happens to be $x=1$.
