Help understanding log entry "CompileAppleScript string failed"

I'm trying to troubleshoot an issue with my macro and I am finding this repeated in my log and can't figure out which part of the macro is leading to the error:

Launch Task /Applications/Keyboard Maestro.app/Contents/MacOS/Keyboard Maestro Engine.app/Contents/MacOS/CompileAppleScript string failed

Thanks!

Where did you find this error log? It does not look like the type of log found in the KM Engine log.
GoTo menu Help > Open Logs Folder, or just open this file:
~/Library/Logs/Keyboard Maestro/Engine.log

I just tested a macro with an AppleScript that will not compile, and I got this KM Engine.log message:

2018-06-07 14:31:58 /var/folders/hb/6xgg0y8j4g530m81rd1f9mpc0000gn/T/Keyboard-Maestro-Script-5C4793D5-BB43-4E60-94D9-C475D2411620:8:9: script error: A end of script can’t go after this number. (-2740)

I also checked the Editor.log, and there were no entires related to this macro.

So, I guess I'd suggest that you start with this:

  1. Post your macro here (image and file)
  2. Restart the KM Engine
  3. Restart the KM Editor app

if still having issues, restart your Mac.

BTW, what versions of KM and macOS are you running?

Those errors are in the Engine.log which I have been using to troubleshoot other issues with the macro...I just can't pin down the cause of this one. It usually appears after the macro has been running successfully for a while. The error is repeated hundreds of times per second for a few seconds before the macro stops. I'd rather not post the macro. MacOS 10.13.4 and KM 8.2.1. The error has persisted through reboots.

Without seeing your macro, it is virtually impossible for us to diagnose.
If the macro contains sensitive info, perhaps you can simplify it to remove/change that info.
In fact, one good method of troubleshooting is to simplify a script or macro as much as possible, ensuring that the problem behavior continues.

You can just select the macro, and press CMD-D to duplicate it. Give it a different name, and start removing large blocks of Actions. Since it seems related to AppleScript, one approach is to remove all Actions (or as many as possible) except for the Execute AppleScript Actions.

1 Like

@Chris_Bell, have you been able to resolve your issue?

I have the same issue almost every day. I run some macros at night. It will be stuck at some point. The whole keyboard maestro froze until I manually move the curse or click any keys on keyboard after waking up. This is quite annoying. And I have tried to find out which action caused this problem, but still no clue at all. I guess it may related to Pause or Set Chrome URL action. The error is about AppleScript. So which action is related to that? Please help. Thanks!

This macro will identify the Macro and the Action causing the error:
MACRO: Display Last KM Macro Error Ver 4 [Pub]

Run this macro immediately after you get the KM error.

This error is still existed at version 10. The whole engine is stuck when this problem occurs. And the engine log has the record as following:

2021-12-04 22:41:01 Launch Task /Applications/Keyboard Maestro.app/Contents/MacOS/Keyboard Maestro Engine.app/Contents/MacOS/CompileAppleScript string failed
Last message repeated 15 times

All the running macros will resume working only until I manually operate the Mac.

Could you please help me to find out why? It's really bothering. @peternlewis

It sounds as if one of your macros might contain an Execute AppleScript action in which the code has a problem (a syntax error, a truncation of some kind, perhaps)

Might be worth:

  • temporarily disabling all the macros that contain Execute Script actions,
  • checking to see whether that has eliminated the problem,
  • then gradually re-enabling the macros to see if you can track down the problematic one(s).

By figuring the problem, I am pretty sure the problem is Wait For Google Chrome to Finish Loading. May a bug existed behind this action?

You would probably need to share your reasoning (and a sample macro) with us.

Certainty impedes the solution of problems – experiment (and the sharing of experimental method) is really the only thing that ever clears a log-jam.