OS Status error -43

I get this error quite often. I have saved a script and when I quit SD, I notice the .scpt file icon does not have the SD icon in the thumbnail. When I try to reload the script into SD I get the Error message
The operation couldn’t be completed. (OSStatus error -43.)

What causes this error?
Is there anyway I can recover the script so that I can open it?
How can I prevent the error from happening again?

I am using a mac (catalina)

Screen Shot 2020-04-13 at 12.26.06

I have just noticed that if I make a copy of the script file, I can open that copy ok and after closing the copy, I can then open the original file again!
But neither file has the SD icon in the thumbnail.

Screen Shot 2020-04-13 at 12.44.25

It sounds like you don’t have Full Disk Access enabled for Script Debugger.

As far as I know I set up Full disk access for SD but how can I check or reset this?
The problem is intermittent. Different versions of the same script will have no problem to start with but if I make minor modifications/additions and save then exit, sometimes I get the error when I try to open the file again.

Open System Preferences to the Security & Privacy panel, click the Privacy tab, then on the left scroll down to Full Disk Access. You will need to click on the padlock at the very bottom-left of the panel to make changes.

Let me know if it was already there and checked.

Thanks Shane, SD did not have full disk access. I was sure I had set this up when I first ran SD. But I have reset it so will keep am eye on it and see how it goes.