Applescript error -10000 when saving Mail attachments in Mojave 10.4.6

applescripterror

My script for the Mail app saves attachments from each message. It was working fine and suddenly started generating this error in macOS 10.14.6 Mojave:

--> error "To view or change permissions, select the item in the Finder and choose File > Get Info." number -10000

The script line that resulted in this error was:

save mail attachment id "2" of message id 33167 of mailbox "Trash Later" in "/Volumes/Backup/email attachments/ATT00001.jpg"

I tried changing the permissions of the target folder using "chmod 775" but no luck.
Apple's documentation has this cryptic description of the error:

-10000 The Apple event handler failed.

Any suggestions?

Best Answer

Following a hunch that it had to do with the steadily increasing new permissions requests, I added the "Script Editor" app to this preference:
System Preferences > Security & Privacy > Full Disk Access

The error -10000 disappeared and the script is back to saving attachments.
I'll update if the error returns.