The absolute first thing to try when an error occurs is to switch to the Keyboard Maestro Editor using the System UI (NOT a macro), and activate this menu item:
The next thing to try is:
After that it's time to look at the Keyboard Maestro Engine Log file.
I use the macro @cfriend references above myself (since I wrote it), but some people prefer @JMichaelTX's Display Last KM Error macro.