[BUG] Authentication Error: Invalid bearer token persists after login
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?
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
I'm experiencing a persistent authentication error when trying to use Claude Code. The error occurs even after attempting to log in again.
Error Message:
API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid bearer token"},"request_id":"req_011CUZZAc8AFoCvShVWRHngg"}
Please run /login
Steps to Reproduce
- Launch Claude Code
- Attempt to execute any command
- Receive 401 authentication error
- Run
claude logoutfollowed byclaude login - Error persists after re-authentication
Expected Behavior
Commands should execute successfully after logging in with valid credentials.
Actual Behavior
The authentication error continues to occur even after:
- Logging out and logging back in
- Reinstalling Claude Code
- Completely uninstalling and reinstalling the application
The bearer token appears to be invalid or not being refreshed/stored properly.
Environment
- Claude Code Version: 2.0.28 (latest)
- OS:macOS
Additional Context
I have tried the following troubleshooting steps without success:
- Complete uninstall and reinstall of Claude Code
- Logging out and logging back in multiple times
- Checking for version updates (already on latest 2.0.28)
The issue suggests a problem with token storage, refresh, or validation on the client side.
What Should Happen?
claude code should login
Error Messages/Logs
API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid bearer
token"},"request_id":"req_...."} · Please run /login
Steps to Reproduce
1) claude
./login -> error
2) restart , npm uninstall/install or /logout ..rm -rf claude/claude.json or downgrade verions
3) unset ANTHROPIC_BASE_URL ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN
-> not give solution -> always this error
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.28
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗