Cannot save document error

I’ve been getting this error message when I try to save a script.
Cannot save document
invalid component instance (badComponentInstance:-2147450879)”

Script has a lot of myriad tables calls.

Any suggestions?
→ Script Debugger 7.0.13 (7A125)
→ Mac OS 10.11.6 (15G22010)

I’m now encountering this also after some weird crashes. No external code involved except scripting additions and foundation framework.

→ Script Debugger 7.0.13 (7A125)
→ Mac OS 10.14.6 (18G8022)