How to fix STM32CubeIDE: Error in final lauch sequence – Setup exceptions (debugger)

Problem:

While trying to start the STM32CubeIDE debugger, you see the following error message just after clicking Continue :

Error in final launch sequence

Setup exceptions
Setup exceptions

Solution:

This error occurs because you clicked Continue too early. The flashing process was still underway when you clicked Continue. Therefore, the solution is to wait until the stack trace shows main() and only then click Continue.