Problems launching AppleScript (silently fails)

I have problem running the following script via BTT:

tell application "System Events"
tell process "Safari Technology Preview"
click menu item "Open in New Tabs" of menu 1 of menu item "ACC" of menu 1 of menu item "Favorites" of menu 1 of menu bar item "Bookmarks" of menu bar 1
end tell
end tell

It works just fine when launched directly from Script Editor. OTOH BTT has no problems launching other AppleScript scripts. Any help on finding out what's happening would be highly appreciated.

Thank you for your time, and the great work you put into BTT!

macOS: 15.5, M4 MBA, BTT 5.468

Possibly BTT doesn't have permission to automate System Events in System Settings => Security & Privacy => Automation

However operating menu items can in general be very tricky and fail for no obvious reasons. Better use BTT's integrated predefined action "Trigger Menu Bar Menu Item" instead. (Bookmarks;Favorites;Open in New Tabs )

Thank you for immediate reaction. BTT indeed has permission for automating System Events enabled. And it works in other cases – like with this script:

tell application "System Events"
tell process "Downcast"
click button 8 of window 1
end tell
end tell

But somehow doesn't work in the case of the previously mentioned script accessing the menu bar (and this script works just fine via AppleScript Editor or the Spark.app launcher).

On another note, using 'Trigger Menu Bar Menu-Item' action also doesn't work here. Tried with this "Safari Technology Preview" items (like mentioned in the original script), and also with some basic stuff like "apple;System Settings…".

If I can get you any logs or something – I will be more than happy to do so.

I can't think of much that would make this fail (apart from permissions). Possibly try to restart your Mac once.

It's pretty strange that your other scripts are working.

You could try monitoring the logs in the macOS console app for "System Events", when executing the script but there might not be anything useful logged.