Help! Cannot run macro as said not found - even from the macro itself!

I've been using KeyBoard Maestro for years and just recently installed 11.0.3. I am running that on a Late 2014 iMac with macOS Big Sur 11.7.10 (which is the latest version Apple has for this computer).

I had been using 11.0.3 for some time, and then all of a sudden moments after running other macros, a whole bunch of my macros won't run because I'm getting an error message that the macro cannot be found, even when I'm running it from the very same macro!

I've created a bunch of macros to download my month bills and bank/investment statements. Since they come out on different days during the month I store the run dates in a separate macro and then created a macro to display those in a window for me:

However, even when I'm in that macro and click the run button I get this error message that it can't be run as it can't be found!!
Screen Shot 2024-06-01 at 7.17.13 AM

Here is another one that is doing the same thing:

Screen Shot 2024-06-01 at 7.35.45 AM

I've tried closing and relaunching Keyboard Maestro and even rebooting my Mac, but that didn't help.

What could possible be causing this and how can I fix it?

You've misread/misunderstood the error message.

It is saying that the macro "ZZ Display Run Dates For All Bills and Statements" has been cancelled because an Execute Macro action within that macro has failed to find whatever macro it is trying to execute.

The same is true for the other example you give.

So, look in your macro for an Execute a Macro action to see which macro can't actually be found.

If that still doesn't make sense to you please post the macro here so we can examine it.

And as always, when you see a truncated error like this in a notification, go to the logs to see the full text of the related messages. I built a dummy example that referenced a macro, then deleted the macro. That generated these log entries:

2024-06-01 05:01:16 Execute macro “shell” from trigger Editor
2024-06-01 05:01:16 Action 15981136 failed: Execute a Macro action failed to find the macro to execute
2024-06-01 05:01:16 Execute a Macro action failed to find the macro to execute. Macro “shell” cancelled (while executing Execute a Macro).

The important bit in all of that is Action 15981136 failed. That's the specific action in the macro that caused the error. But how is that useful? With a tiny bit of AppleScript…

tell application "Keyboard Maestro"
	selectAction 15981136
	activate
end tell

...you can have the editor highlight the exact spot of the problem:

I ran the above from AppleScript, but I keep a global macro around that copies the selection and then runs the above script on the clipboard, so I can hit a hot key after selecting an action while viewing the log. It's quite simple, so here it is if you'd like to use it. (The AppleScript isn't mine; I found it here in some other thread a while ago.)

Download Macro(s): Show action for matching Action ID.kmmacros (34 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 14.5
  • Keyboard Maestro v11.0.3

-rob.

I went in and found the problem. So it is resolved, but is there a way to get the error messages to stay up or go to it so it isn't only showing for a few seconds (and then often truncated)? Also, when I clicked on the Show button that appears when I hover my mouse over the error message, it would help if it took me to the step that failed. Likewise, when it fails to find a macro it would be much more useful if it put in the name of the macro it didn't find.

Refer to @griffman's reply to get more info out of the log etc.

This is a limitation of the Notification system. Peter can't suppress the Show button, but he also can't make it do anything useful.

There isn't, but as noted in my reply, you can see more (much more, usually) in the logs. Help → Open Logs Folder will take you there, then you can open the Engine.log in a text editor. It's a big file, though, so I have another simple macro that runs tail (which displays the most recent entries in a file) on the log files. If I run that after an error, then only the last few lines will appear onscreen, making it easy to see the Action ID and use my other macro.

This is another simple macro; this one is in a group that only runs in the KM Editor, as that's the only place it makes sense. It's got one optional feature, in that if I invoke it with the Shift key down, it opens the log in BBEdit, otherwise, it just tails the log in Terminal. In that output, I can then select the Action ID and activate the earlier macro to find that action.

Download Macro(s): Work with the log file.kmmacros (30 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 14.5
  • Keyboard Maestro v11.0.3

Note that if you do a lot of this stuff, there's a very comprehensive tool by @_jims that makes this all really easy—but it's probably not needed if you're not writing a lot of complicated macros.

-rob.

1 Like

Thanks for all the help. I was looking at all the KB menus and couldn't find one to display the logs. However, under View, there was a selection to Go to Last Aborted Action that took me there, so that was what I needed here.

Screen Shot 2024-06-01 at 8.17.52 AM

1 Like

Ah yes, I'd forgotten about that menu command, mainly because I tend to write things that fail quite often and in many different ways, so I've gotten used to digging around in the logs :).

-rob.

Yours look like it could be very useful, but where are the logs?

You can open their folder via the menu item I listed earlier, Help > Open Logs Folder. They live in your user's Library > Logs folder.

-rob.

Sorry, I missed that somehow. Is the one I want the Engine log as it shows me what ran vs. the Editor long that would show what changes I made to a macro?

Yes, Engine.log. The second macro I posted works directly with that file.

-rob.

Another thing you could do is create a macro like this that you can trigger with a hotkey. This will instantly display the last 5 errors on the screen, with their dates and times.

image

1 Like