I see you mention using M2 at the end of a program, but your sample shows M30.
Is there any difference in what happens if you use M2 versus M30? Perhaps the control goes wonky if it reads an m-code that it does not support?
I see your program omits any spindle speed commands or tool length offset commands, or, at the end of the program, tool offset cancellation and return to home commands. It could be the case that some of these functions might be hard-coded to occur, but something has not been carried out, which results in the error.
Does this control use work offsets? Or, does it rely on the use of G92 to set a program home?
First you get good, then you get fast. Then grouchiness sets in.
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)