Debugger stops before the breakpoint in the on run-handler

When I run my (quite lengthy) script in Scripting Debugger, it just runs as expected. However, just recently the debugger just doesn’t do it for me. I set a breakpoint on the first statement in the on run handler, and it won’t reach it. Press Run, status bar says Running, and after a while Stopped.

When I look at the output in Console.app I see the following two lines repeat:

RKOSAID _failOSError: errOSAInternalTableOverflow .....
legacyRuntimeScript called!!!!! - please save the script you are running and report this incident to support@latenightsw.com

I’m on macOS Big Sur 11.2.3 and it happens in both Script Debugger 7.0.13 (7A125) and 8 (8A11).

Does this (errOSAInternalTableOverflow) mean my script is too large?

Yes, unfortunately, it does. Our guidance is that scripts should not exceed 2000 lines. The actual limit on script side depends on many factors, but 2000 source lines is a good rule of thumb.

The solution is to break you script up into libraries, each compiled separately, and then referenced using AppleScript’s use script... statement. Unfortunately, you’ll loose the ability to debug handlers within Script Libraries.

Script Debugger is failing here too in that it should be reporting the errOSAInternalTableOverflow error rather than behaving erratically. But the root cause of the problem is the length of your script.

Ok, good to now. Shifting priorities.

One note though: the actual length of my main script (without the Scripting Libraries) is 1894 lines. Not sure this helps.

Thanks for the data point.

The errOSAInternalTableOverflow error code indicates that something about your script is causing AppleScript to fail. Length is the most frequent cause, but other causes are possible. Whenever errOSAInternalTableOverflow appears you have to assume that AppleScript has become corrupted and quitting/re-launching Script Debugger is highlight advisable.

1 Like