Why do random errOSAInternalTableOverflow errors return when running AppleScripts via ScriptingBridge?

We have an app that controls InDesign Desktop and InDesignServer via hundreds of AppleScripts. Some macOS security updates a while back dictated that we start communicating with other apps via ScriptingBridge. We couldn't afford to convert the hundreds of AppleScripts into direct ScriptingBridge nomenclature, so we opted to keep them as is and instead tell the external apps to:

[app doScript:<the script text> language:InDesignScLgApplescriptLanguage withArguments:nil undoMode:InDesignESUMScriptRequest undoName:@"blah"]

There are a handful of scripts that we did convert to direct ScriptingBridge.

There are times (and under the right circumstances, it's repeatable) when a certain script will have run perfectly dozens of times, and then it will throw errOSAInternalTableOverflow.

We create a new SBApplication for every job (which could be a single instance of Desktop or the multiple instances of Server).

Why is this error happening seemingly randomly? Is there anything we can do to work around or prevent this?

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. Please file a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the Feedback number here once you do. I'll check the status next time I do a sweep of forums posts where I've suggested bug reports and post any information about changes I am able to share to this thread.

Bug Reporting: How and Why? has tips on creating your bug report.

Hoo boy, making a sample app might be tricky. I'll find time to see if it's possible. Is there any way to know if the error is coming from OSA/SB or if InDesign is doing something goofy that would cause that error to be returned?

Why do random errOSAInternalTableOverflow errors return when running AppleScripts via ScriptingBridge?
 
 
Q