# Issue with 1D particle in a box position expectation value

In the simplest particle-in-a-box experiment, a particle is confined to a potential where $V(x)=0$ on the interval $[0,a]$ and $V(x) = \infty$ otherwise. Then the energy eigenvalue equation, $\hat{H} \psi_n = E_n \psi_n$ is solved, where $\hat{H} = -\frac{\hbar^2}{2m} \frac{\partial^2}{\partial x^2}$, and the energy eigenstates are found to to be $\psi_n(x) = \sqrt{\frac{2}{a}} \sin(k_n x)$. This is usually one of the very first exercises in an introductory physics class.

Now, these eigenstates were found using the Hamiltonian, so they are eigenstates of the Hamiltonian. I see a lot of places on the internet that then try to find an expectation value for position, $\langle x \rangle$, using the eigenstates of the Hamiltonian. But this Hamiltonian operator and the position operator don't commute. Therefore, these two operators don't have a common set of eigenstates. Therefore, you shouldn't be able to use the eigenstates of the Hamiltonian to calculate the position expectation value. Is this right, or am I missing something?