Sometimes, when discussing quantum field theory, people speak as if a Hamiltonian determines what the Hilbert space is. For example, in this answer AccidentalFourierTransform says
Imagine an $H_0$ that depends on the phase space variables $P$,$X$. [...] If you add the perturbation $\vec{L} \cdot \vec{S}$, with $\vec{S}$ the spin of the particle, then you change the Hilbert space, because the new space has three phase space variables $P,X,S$, and you cannot span the latter with a basis of the former.
This kind of language also pops up when introducing the free scalar field -- lots of lecture notes and textbooks speak of 'building' or 'constructing' the Hilbert space, or 'finding' the 'Hilbert space of the Hamiltonian'.
This kind of reasoning seems exactly backwards to me. How can one possibly define a Hamiltonian, i.e. an operator on a Hilbert space, if we don't know the Hilbert space beforehand? Without a Hilbert space specified, isn't $H = p^2/2m + V(x)$ just a meaningless string of letters with no mathematical definition? I find this shift of perspective so bewildering that I feel like I missed a lecture that everybody else went to.
For example, when dealing with the harmonic oscillator, it is possible to show that the Hilbert space must contain copies of $\{|0 \rangle, |1 \rangle, \ldots \}$ using only the commutation relations. But there's no way to pin down how many copies there are unless we use the fact that the Hilbert space is actually $L^2(\mathbb{R})$ which shows that $a |0 \rangle = 0$ determines a unique state. Similarly I would imagine for quantum fields we should start with a Hilbert space where the individual states are classical field configurations, but I've never seen this done in practice -- there seems to be no input but the Hamiltonian itself. How could that possibly be enough?