Failed to execute script '__main__' due to unhandled exception!

1,808 views
Skip to first unread message

Andrew Steidl

unread,
Aug 4, 2022, 10:27:55 AM8/4/22
to GAM for Google Workspace
When I try to run most commands in GAM, I get "Failed to execute script '__main__' due to unhandled exception!" Even something basic like "gam info user". a few commands like "gam rotate sakey" or "gam user xx...@xxxx.com check serviceaccount" work OK

I've already tried updating to the latest version.

Full error text:
gam info user
Traceback (most recent call last):
  File "gam\__main__.py", line 49, in <module>
  File "gam\__main__.py", line 44, in main
  File "gam\__init__.py", line 11510, in ProcessGAMCommand
  File "gam\__init__.py", line 8778, in doGetUserInfo
  File "gam\__init__.py", line 1009, in buildGAPIObject
  File "gam\__init__.py", line 937, in getValidOauth2TxtCredentials
  File "gam\auth\oauth.py", line 474, in refresh
  File "gam\auth\oauth.py", line 482, in _locked_refresh
  File "google\oauth2\credentials.py", line 302, in refresh
  File "google\oauth2\reauth.py", line 347, in refresh_grant
  File "google\oauth2\_client.py", line 62, in _handle_error_response
google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', {'error': 'invalid_grant', 'error_description': 'Bad
 Request'})
[5248] Failed to execute script '__main__' due to unhandled exception!

Ross Scroggs

unread,
Aug 4, 2022, 10:32:51 AM8/4/22
to google-ap...@googlegroups.com
Andrew,

Do:
gam oauth delete
gam oauth create

This will rebuild oauth2.txt which is used by 'gam indo user' for example.

--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/ddfee65f-4424-42d8-8a80-1e68fc9b078en%40googlegroups.com.

Andrew Steidl

unread,
Aug 4, 2022, 11:10:38 AM8/4/22
to GAM for Google Workspace
That worked.  Thanks!
Reply all
Reply to author
Forward
0 new messages