I can't see where I've gone wrong in the following proof. The statement above is wrong, as any topological space can be endowed with a constant sheaf.
Proof. That any set $X$ endowed with the trivial topology admits a constant sheaf is obvious: for any set $E,$ let $\mathscr{F}(X) = E.$
Conversely, suppose that $X$ admits a constant sheaf. Then since $X$ is irreducible, for every nonempty open set $U$ of $X,$ the restriction $\mathscr{F}(X)\to \mathscr{F}(U)$ is a bijection$^1$. We recall that a sheaf is a functor, $\mathscr{F}\colon \mathbf{Ouv}_X^{\text{op}} \to \mathbf{Set},$ where $\mathbf{Ouv}_X$ is the category whose objects are open $U\subseteq X$ and whose morphisms are the inclusions. Functors preserve isomorphisms; therefore $\mathscr{F}(X) \cong_{\mathbf{Set}} \mathscr{F}(U)$ implies that $X \cong_{\mathbf{Ouv}_X} U,$ i.e., $X = U.$
- Exercise $2.13$ in Algebraic Geometry I: Schemes, With Examples and Exercises by Ulrich Görtz and Torsten Wedhorn.
It is not true that $\mathscr{F}(X)\cong\mathscr{F}(U)$ implies $X\cong U$! "Functors preserve isomorphisms" goes the other direction: if $F$ is a functor and $f:A\to B$ is an isomorphism in the domain category, then $Ff:FA\to FB$ is also an isomorphism, so if $A\cong B$, then $FA\cong FB$. The converse is not necessarily true.