[Bug] Environment variable OAuth token silently overrides subscription credentials after plan upgrade

Resolved 💬 3 comments Opened Apr 7, 2026 by lvalics Closed Apr 11, 2026

Bug Description
Hi Claude Code team,

I ran into a frustrating issue after upgrading from Pro to Max 20x and wanted to flag it as a UX/bug report.

Summary: After upgrading my plan, Claude Code in WSL kept enforcing the old Pro rate limits even though my account on claude.ai clearly showed Max 20x as active. None of the standard fixes worked: /logout + /login, deleting ~/.claude/.credentials.json, restarting WSL, reinstalling — the limit persisted.

Root cause (took a long debugging session to find): I had a CLAUDE_CODE_OAUTH_TOKEN environment variable set in ~/.claude/.env from months ago. Claude Code was silently using that token on every startup instead of the fresh OAuth credentials from my browser login. The token was bound to the old Pro tier, so the upgrade never took effect on the CLI side. claude logout does not clear or warn about this env var, and .credentials.json gets rewritten correctly on each login but is then ignored in favor of the env var.

The only hint that something was off was the /status screen showing `Auth token: [REDACTED] instead of the normal OAuth source — but you have to know what you're looking at to spot it.

Suggestions:

  1. When claude login runs and a CLAUDE_CODE_OAUTH_TOKEN (or ANTHROPIC_API_KEY) is set in the environment, print a clear warning: "You are authenticated via env var X, which will override this login. Unset it to use your subscription."
  2. When a user hits a rate limit, the error message should mention which auth source is being used and link to docs on how to switch.
  3. claude logout should at minimum detect and warn about overriding env vars, even if it can't unset them from the parent shell.
  4. The /status screen is great but the Auth token:[REDACTED] line could be more explicit — e.g. Auth: env var (CLAUDE_CODE_OAUTH_TOKEN) — overrides subscription login vs Auth: OAuth subscription (Max 20x)`.

This would have saved me probably an hour of debugging. Happy to provide more details if useful.

Thanks!

Environment Info

  • Platform: win32
  • Terminal: windows-terminal
  • Version: 2.1.92
  • Feedback ID: 8154e1b2-2016-4db3-b512-1b5190611ae8

Errors

[]

View original on GitHub ↗

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