Hi,
when I try to run a very simple JXA script in Script Editor, it throws an error -1743 the first time I call a DT method. The same happens with other apps like System Events.
I believe that this is related to a global privacy setting, i.e. Script Editor does not appear in the list of applications unter “Automation”.
Edit: The same happens with AppleScript, where the error handler helpfully tells me that “There’s no permission to send Apple Events to DEVONthink 3” (my translation).
Assuming that the macOS version is actually 11.6, then it works fine over here although the Script Editor.app is not listed in System Preferences > Security > Automation.
Sorry, I’m on 11.6, just updated today. Update
I removed all access to Apple Events with tccutil reset AppleEvents
Now running a JS script from the command line opens a little window asking to permit iTerm2 to run Apple Events.
In Script Edtior, I do not get this window, just the same error -1743 as before.