ALERT: "Cannot save document" error on Catalina systems

IMPORTANT NOTE FOR CATALINA USERS

The Problem

We have identified a problem where Script Debugger becomes unable to save document changes to compiled script (.scpt) and text (.applescript) AppleScript files on macOS Catalina systems.

This problem happens after a document has been opened in Script Debugger and changes have been saved a number of times. If the saves are done in fairly quick succession, Script Debugger will begin reporting that it cannot save document changes. In some instances, errors -54 (permErr) or -43 (fnfErr) are reported. Additionally, once this situation arises and you close the document, it is no longer possible to open the effected document in Script Debugger.

Workarounds

We have found that if one simply waits, the problem clears itself and you can once again save changes and open documents.

Another solution is to save your document as a compiled script bundle (.scptd filename extension) as this file format stores its meta-data in a way that does not trigger this problem.

We have implemented a partial workaround for this issue in the upcoming Script Debugger 7.0.11 maintenance release. This change should avoid the problem where document changes cannot be saved, though meta-data stored in the document by other applications such as the Script Editor may be lost. However, this change does not address the problem where documents cannot be opened.

You can download a pre-release Script Debugger 7.0.11 build containing this fix here:

http://www.latenightsw.com/archives/beta_for_script_debugger/ScriptDebugger7.0.11-7A101.dmg

Background

This situation can be reproduced outside Script Debugger which leads us to believe it is a macOS Catalina problem rather than a Script Debugger problem.

At a technical level, the problem is triggered when applications attempt to read the resource fork of a document repeatedly within a given period of time. This behaviour by an application seems to trigger a security mechanism within Catalina that prevents further access to the document’s resource fork (the resource fork is used to retain meta-data in text and compiled AppleScript documents).

To reproduce the problem you can follow these steps:

  1. Create a simple document using the Script Editor
  2. Save the document as a compiled script file (.scpt filename extension)
  3. Make some changes, and save again, repeat a couple of times
  4. Close the document
  5. Use DeRez from the command line to view the file’s resource fork and you’ll get a permErr (-54):
mark$ DeRez /Users/shane/Desktop/TestScript.scpt 
### DeRez - permErr (-54) during open of resource file "/Users/shane/Desktop/TestScript.scpt".

We are working with Apple to resolve this issue and will update Script Debugger again when a solution to the problem becomes available. However, it may turn out that macOS Catalina will need to be updated to resolve the issue in which case we’ll have to wait for Apple to release an update.