[BUG]

Resolved 💬 3 comments Opened Mar 13, 2026 by sssky1 Closed Mar 17, 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?

  • Environment variable ANTHROPIC_AUTH_TOKEN was updated
  • However, Claude Code continues to use the old token stored in .claude.settings
  • This results in authentication failure

What Should Happen?

Claude Code should prioritize the ANTHROPIC_AUTH_TOKEN environment variable, or at minimum check for updates on
startup. Instead, it stores the old token in .claude.settings and keeps using this cached value without syncing when
the environment variable changes.

Error Messages/Logs

Api error 400

Steps to Reproduce

  1. Set the ANTHROPIC_AUTH_TOKEN environment variable to an initial value (e.g., token_old) 2. Start Claude Code - it reads the token and saves it to .claude.settings
  2. Update the ANTHROPIC_AUTH_TOKEN environment variable to a new value (e.g., token_new)
  3. Verify the environment variable was updated correctly by running:

echo %ANTHROPIC_AUTH_TOKEN% (on Windows)
echo $ANTHROPIC_AUTH_TOKEN (on Linux/Mac)
The output should show the new token value

  1. Restart Claude Code
  2. Claude Code still uses the old token from .claude.settings instead of reading the updated environment variable
  3. Authentication fails with the old token

Expected Behavior:
Claude Code should detect the updated environment variable and use the new token value on restart.

Actual Behavior:
Claude Code continues to use the stale token cached in .claude.settings, ignoring the updated environment variable.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.74

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

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