maybe a nation decision to relocate your government to one of your colonies during a war when you're at around -95% warscore or something.
this will result in your opponent getting 100% and brokering full annexation/spiting your lands among his allies/returning cores/releasing nations/whatever is appropriate to the type of war you where fighting.
you keep any army or navy forces you had, in addition to what your colonial nation had when you took over, where you disband or relocate them to your new home as you see fit.
the hit you take in stability, diplomatic reputation, and opinion with any colonies or vassals that you didn't lose during the peace deal will be devastating, but it's better than game over.
there should also be an option to reintegrate colonies that you share borders with.