This is a problem with authentication - it is trying to provide a command-line auth prompt, which does not work when the terminal is connected to Unreal - it is not interactive.
I’d try logging in on the website before opening. Not sure it’d work, though.
Thanks for the insightful response. Unfortunately I was already logged into the Shotgrid website when this happened, so no joy there.
I managed to find a solution to this, or at least a workaround. After some poking around in the Shotgun support docs I created a toolkit.ini file here (obviously I edited out the username!):