In the derivation of energy density of a black body, we calculate the number of modes by solving the EM wave equation. In this case we get that $$n=\sqrt{n_x^2+n_y^2+n_z^2}$$ Here we divide $n$ in three coordination in $n$-space, $n_x$,$n_y$,and $n_z$. These are all integers as we took those constants in solving the EM wave equation using the boundary condition that at $x=a$, $E=0$.
So as we know that at the wall of the cavity the electric field is zero, so there will be a node if I consider the EM wave as standing wave. From wall to wall an EM wave must have two nodes at the two ends of an EM standing wave, so the length of the EM wave will be an integer multiple of half the wavelength, or $$L=n\lambda/2$$ Where $n$ is an integer.
So we can conclude that $n$, $n_x$, $n_y$, $n_z$ are all integers, but how can this be possible? If I say, for example, that $n_x=n_y=n_z=1$, then I have $n=\sqrt{3}$, which is not an integer.
So what is incorrect in the statement that all four constants $n$, $n_x$, $n_y$, and $n_z$ can't be integers simultaneously every time?