[BUG] 401 on all API calls despite valid Max subscription — /status confirms auth but every command fails

Resolved 💬 2 comments Opened May 21, 2026 by GrantS-C Closed May 21, 2026

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:

  1. Multiple fresh installs (npm uninstall + install)
  2. Downgrade to v2.1.89
  3. rm -rf ~/.claude (multiple times)
  4. rm -rf ~/.claude/auth
  5. macOS Keychain clearing (security delete-generic-password)
  6. unset ANTHROPIC_API_KEY (no key was set — env | grep ANTHROPIC returns empty)
  7. --bare mode (returns "Not logged in")
  8. Terminal restarts, full machine restart
  9. 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:

  1. Multiple fresh installs (npm uninstall + install)
  2. Downgrade to v2.1.89
  3. rm -rf ~/.claude (multiple times)
  4. rm -rf ~/.claude/auth
  5. macOS Keychain clearing (security delete-generic-password)
  6. unset ANTHROPIC_API_KEY (no key was set — env | grep ANTHROPIC returns empty)
  7. --bare mode (returns "Not logged in")
  8. Terminal restarts, full machine restart
  9. 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

  1. npm install -g @anthropic-ai/claude-code
  2. rm -rf ~/.claude
  3. security delete-generic-password -s "claude-code" 2>/dev/null
  4. claude login
  5. Trust the workspace when prompted
  6. Type any prompt — returns "API Error: 401 Invalid authentication credentials"
  7. /status shows Login method: Claude Max account, correct email and org
  8. 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_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗