I wanted to find all non-abelian groups of order 8 up to isomorphism, but I ran into a contradiction and I can't find the error in my reasoning. My reasoning was as follows:
Since the groups we're after are non-abelian 2-groups, their center is neither trivial nor the whole group. So let's do a case distinction on the order of the center being either 2 or 4.
If the center $Z/(G)$ has order 4, then the quotient group $G/Z(G)$ has order 2 and is therefore cyclic. We now invoke the following theorem to reach a contradiction on G being non-abelian.
So the center has order 2 and the quotient group $G/Z(G)$ has order 4. The Klein four-group is the only non-cyclic group of order 4 (which is isomorphic to $\mathbb{Z}_2 \times \mathbb{Z}_2$), so it holds that $G/Z(G) \cong G/\mathbb{Z}_2 \cong \mathbb{Z}_2 \times \mathbb{Z}_2$. But now all my elements have order 2, right? Which would mean the group is abelian again.
The actual solutions are the dihedral and and the dicyclic group and even though I understand that proof, I simply cannot find the error in my proof, mainly because I'm new to group theory. So any help is deeply appreciated.