[BUG] Claude Code npm package immediately enters interactive mode with OAuth expired error - authentication commands don't trigger OAuth flow
Resolved 💬 8 comments Opened Jul 1, 2025 by clah82 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
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗