What does the error message "state discontinuity after switching" mean?

Problem description: 

My simulation stopped suddenly with this message, but it had been running fine up until then, why does this happen?

Solution: 

The issue is caused when you attempt to interrupt an inductive current or capacitive voltage instantaneously, which is not possible with ideal components. The error message will explicitly state which type of pheonomena causes the error and at what time during the simulation.

To explain this further with regards to an instantaneous changes in inductive current, unless the current can find a new path in the circuit (e.g. through a free-wheeling diode or small resistance), PLECS will report this error. In a real system, if you chop off inductive currents, you will see voltage spikes across the inductors, which likely will damage your circuit.

If you encounter such an error it is likely a systematic problem of your circuit topology and/or your modulation scheme.