Tip: Cryptic macOS file error

Just thought I'd share a tip I just learned while investigating why one of my flows randomly stopped working back on Feb 21, 2025. This may have coincided with a macOS update...

I previously dealt with a file access issue after an update to Sonoma that is well described in my post on the Apple Developer Forum (you may or may not need an account to access it?). Briefly, on top of file system permissions, you need to grant file access to a process (node). Basically, you have to add node to either Files and Folders or Full Disk Access in the System Settings, and check the access you want to grant it. There is a specific iCloud Drive toggle under Files and Folders.

I have a flow that writes to a file in iCloud Drive. I had no reason to believe that anything about that file had changed, so it took me awhile to figure out why my file node was throwing the following cryptic error:

failed to write to file: Error: Unknown system error -11: Unknown system error -11, open '/Users/robleach/Library/Mobile Documents/com~apple~CloudDocs/Automations/SpokenReminders/motion_reminder_active_states.txt'

It turned out to have been simple: the file's permissions (via some mysterious means) had been changed to read only. My guess is that a recent macOS update had changed it due to some security policy, but I don't know for sure. I was able to add write permission via chmod and everything was good to go.

Since googling (even portions of) that error yields no relevant results, I figured I wanted to post somewhere about it. :slightly_smiling_face:

2 Likes