Paste an error to match it against the wiki. / 粘贴报错后自动匹配。
Error text / 报错原文
OAuth token expiredOAuth token revokedinvalid_grantinvalid_token
What it means
A local tool or MCP server is trying to use an OAuth credential that the provider no longer accepts.
Most common causes
- Token lifetime expired
- User revoked app access
- Password or SSO policy changed
- Refresh token stored for a different client or account
Fastest fix
- Reauthenticate the affected tool
- Clear only that tool/server auth entry
- Confirm the active browser account
- Retry with a fresh session
Safe fix
- Use official OAuth flows
- Store tokens in OS keychain or tool-managed files
- Use service accounts for automation where supported
- Audit token scopes periodically
What not to do
- Do not share refresh tokens in issue reports
- Do not copy tokens between machines
- Do not bypass SSO policy with personal accounts
How to confirm the fix
Run the smallest reproducible command first, then retry the agent task only after authentication, quota, and tool discovery are stable.
date -u env | grep -i token git config --global --get credential.helper
Related errors
- Not logged in - Please run /login - Claude Code →
- Failed to exchange authorization code for token - Antigravity →
- Failed to get OAuth token: state syncing error: key not found - Antigravity →
- 401 / 403 PERMISSION_DENIED - Gemini CLI authentication errors →
- You've hit your session limit / weekly limit - Claude Code →
- Prompt is too long - Claude Code context window →