AppleScript, set the position of the frontmost window, even if not AppleScriptable
The answer was to allow SystemUIServer.app to control the computer, in the Security > Privacy > Accessibility preferences. I had so many Finder windows open, I can only assume that the warning dialogue was popping up behind them. Once the permission is granted, it works fine.