Problem with System Events

Hello
I’m on Sequoia 15.7.4 and I’m having a problem with “system events” in Script Debugger that doesn’t seem right.
According to the error message, Script Debugger, and all the scripts that use it, don’t have permission to use “System Events,” but only intermittently! Sometimes it works, sometimes it doesn’t.
Are you experiencing this problem?
I’ve obviously reset the permissions in the Mac’s system settings, then restarted, and run Onyx for a cleanup. It hasn’t changed anything. It’s random.
Could this be due to some new, specific OS protection that activates intermittently?

Are you sure the error is not telling you that System Events lacks the required permissions? Make sure it has access to Files and Folders.

The script debugger seems to have all the necessary permissions in “Full Disk Access”, “Accessibility”, and “Automation” in the system settings. Are there any other permissions I should be aware of?
And above all, why does it work once, then stop working, then work again…? Strange

It may be that you’re asking System Events to access folders or files that it doesn’t have permissions – so not Script Debugger’s permissions.

What happens if you run a script that fails in Script Editor?

So now it’s working again. But for how long?
When it wasn’t working, the script editor couldn’t use “System Events” either.
This simple script didn’t work with SD or Script editor :
‘’’
tell application “System Events”
keystroke “a”
end tell
‘’’
Something must be turning on and off somehow in the system…
Maybe I’m the only one experiencing this.
Chat Gpt suggests it might be due to a new feature called “Secure Input” that Apple supposedly integrated in macOS 15…