A non-linear Diophantine condition involving perfect squares and arising from an inhomogeneous wave equation on the torus guarantees the existence of a smooth solution. The exceptional set associated with the failure of the Diophantine condition and hence of the existence of a smooth solution is studied. Both the Lebesgue and Hausdorff measures of this set are obtained.