[BUG] Claude Code npm package immediately enters interactive mode with OAuth expired error - authentication commands don't trigger OAuth flow
Status Fixed / completed
Maintainer reply None cached
Activity 8 comments · opened Jul 1, 2025 · closed Jul 28, 2025
Environment
- Platform: Anthropic API
- Claude CLI version: 1.0.39 (Claude Code)
- Installation method: npm install -g @anthropic-ai/claude-code
- Operating System: macOS
- Terminal: Terminal.app and Cursor integrated terminal
- Node version: v22.17.0 (also tested with v23.11.0)
Bug Description
Claude Code immediately enters interactive mode when running claude command, and all authentication-related commands fail with OAuth expired error without ever triggering the browser OAuth flow.
Steps to Reproduce
- Install Claude Code:
npm install -g @anthropic-ai/claude-code - Run
claude - Immediately drops into interactive mode with welcome message
- Try any auth command:
login,auth login,authenticate,auth - All return:
API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth token has expired. Please obtain a new token or refresh your existing token."}}
Expected Behavior
Running claude login should open browser for OAuth authentication
Actual Behavior
Never reaches OAuth flow, immediately shows expired token error in interactive mode
Troubleshooting Attempted
- Complete uninstall and cleanup of all config directories
- Tested with Node v22 and v23
- Removed macOS Keychain entries
- Fresh install multiple times
8 Comments
I got this error, any work around? I will switch to local install until it is fixed.
Ps. I did a claude revalidate-token something (something like this) it opens the browser but I still got 401 after that. It seems to be down.
I have got it too, are there any solutions?
I am getting this on Max plan. Claude Code is not responding to any of my prompts or slash commands.
EDIT: I fixed this by /logout and then signing in again.
Antropic server were down:
<img width="689" height="690" alt="Image" src="https://github.com/user-attachments/assets/fb92393f-19c3-4f14-8329-8ed98262ce96" />
Login out and login back also solved for me.
thank you!
i tried without logout - just
/loginand it works!fixed with /logout and /login, thanks!
I finally got it fixed:
The interactive login flow was broken, but direct token setup method worked for me.
Removed all Claude Code cache files, uninstalled the package, cleared npm cache, and reinstalled.
Used claude setup-token command since normal login command was broken.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.