Chromospheric umbral oscillations produce periodic brightenings in the core of some spectral lines, known as umbral flashes. They are also accompanied by fluctuations in velocity, temperature, and, according to several recent works, magnetic field. In this study, we aim to ascertain the accuracy of the magnetic field determined from inversions of the Ca II 8542 Å line. We have developed numerical simulations of wave propagation in a sunspot umbra. Synthetic Stokes profiles emerging from the simulated atmosphere were computed and then inverted using the NICOLE code. The atmospheres inferred from the inversions have been compared with the original parameters from the simulations. Our results show that the inferred chromospheric fluctuations in velocity and temperature match the known oscillations from the numerical simulation. In contrast, the vertical magnetic field obtained from the inversions exhibits an oscillatory pattern with a ~300 G peak-to-peak amplitude, which is absent in the simulation. We have assessed the error in the inferred parameters by performing numerous inversions with slightly different configurations of the same Stokes profiles. We find that when the atmosphere is approximately at rest, the inversion tends to favor solutions that underestimate the vertical magnetic field strength. On the contrary, during umbral flashes, the values inferred from most of the inversions are concentrated at stronger fields than those from the simulation. Our analysis provides a quantification of the errors associated with the inversions of the Ca II 8542 Å line and suggests caution with the interpretation of the inferred magnetic field fluctuations.