You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Guard auto-reauth against transient errors and non-interactive sessions
- Only trigger token deletion + reauth on explicit invalid_grant errors
from Google's OAuth2 endpoint, not on transient network/filesystem failures
- Detect non-interactive sessions (cron, CI, scripts) via TTY check and
fail fast with a clear error instead of hanging on browser OAuth flow
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
returnnil, fmt.Errorf("token for %s is expired or revoked, but cannot re-authorize in a non-interactive session (run 'add-account --force %s' from a terminal)", email, email)
188
+
}
189
+
165
190
fmt.Printf("Token for %s is expired or revoked. Re-authorizing...\n", email)
0 commit comments