[BUG] 401 on all API calls despite valid Max subscription — /status confirms auth but every command fails
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code authenticates successfully (Welcome screen shows, /status confirms "Login method: Claude Max account") but every API call returns "API Error: 401 Invalid authentication credentials" — including normal prompts, cd, login, and logout commands.
/status output:
- Version: 2.1.146
- Login method: Claude Max account
- Organization: grantsparkescarroll@gmail.com's Organization
- Email: grantsparkescarroll@gmail.com
- Model: Opus 4.7 (1M context)
The OAuth token exists locally and is linked to the correct Max subscription, but the API rejects it on every call.
Issue has persisted for 24+ hours across:
- Multiple fresh installs (npm uninstall + install)
- Downgrade to v2.1.89
- rm -rf ~/.claude (multiple times)
- rm -rf ~/.claude/auth
- macOS Keychain clearing (security delete-generic-password)
- unset ANTHROPIC_API_KEY (no key was set — env | grep ANTHROPIC returns empty)
- --bare mode (returns "Not logged in")
- Terminal restarts, full machine restart
- claude update (updated model from Sonnet 4.6 to Opus 4.7, still 401s)
Anthropic support bot confirmed this is server-side token validation, not local config.
Environment: macOS, MacBook Pro, Node current stable, Claude Code v2.1.146
What Should Happen?
Claude Code authenticates successfully (Welcome screen shows, /status confirms "Login method: Claude Max account") but every API call returns "API Error: 401 Invalid authentication credentials" — including normal prompts, cd, login, and logout commands.
/status output:
- Version: 2.1.146
- Login method: Claude Max account
- Organization: grantsparkescarroll@gmail.com's Organization
- Email: grantsparkescarroll@gmail.com
- Model: Opus 4.7 (1M context)
The OAuth token exists locally and is linked to the correct Max subscription, but the API rejects it on every call.
Issue has persisted for 24+ hours across:
- Multiple fresh installs (npm uninstall + install)
- Downgrade to v2.1.89
- rm -rf ~/.claude (multiple times)
- rm -rf ~/.claude/auth
- macOS Keychain clearing (security delete-generic-password)
- unset ANTHROPIC_API_KEY (no key was set — env | grep ANTHROPIC returns empty)
- --bare mode (returns "Not logged in")
- Terminal restarts, full machine restart
- claude update (updated model from Sonnet 4.6 to Opus 4.7, still 401s)
Anthropic support bot confirmed this is server-side token validation, not local config.
Environment: macOS, MacBook Pro, Node current stable, Claude Code v2.1.146
Error Messages/Logs
Steps to Reproduce
- npm install -g @anthropic-ai/claude-code
- rm -rf ~/.claude
- security delete-generic-password -s "claude-code" 2>/dev/null
- claude login
- Trust the workspace when prompted
- Type any prompt — returns "API Error: 401 Invalid authentication credentials"
- /status shows Login method: Claude Max account, correct email and org
- Every subsequent command also returns 401
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
n/a
Claude Code Version
2.1.146
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗