We take the nuclei stationary as a approximation.
This means that in the case that they move a lot this is invalidated.
This would be the case when we don’t have a solid anymore but instead a liquid or a gas, where the nuclei can freely move relative to each other (in contrast to a solid where it tends to be stationary in some form of lattice)
It could also potentially fail in cases of higher temperatures (but the material is still a solid) where the nuclei start moving a lot, but still hold the lattice shape. I would assume in this case we could potentially still use this approximation but it will be less accurate.