Losing steps on X axis whilst cutting air?

For a rapid, if there is a Datum which causes the machine to want to move beyond its working envelope that will result in lost steps.

More likely is that the previous toolpath resulted in lost steps, probably due to high tooling engagement:

Where possible avoid slotting and add geometry and cut as a pocket

and/or

and consider leaving a roughing clearance and taking a finishing pass.