[BUG]
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
- 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
- Update the ANTHROPIC_AUTH_TOKEN environment variable to a new value (e.g., token_new)
- 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
- Restart Claude Code
- Claude Code still uses the old token from .claude.settings instead of reading the updated environment variable
- 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_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗