[BUG] Authentication issue

Resolved 💬 3 comments Opened Apr 6, 2026 by Goal-Atlas Closed Apr 9, 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?

Bug Report — Claude Code 401 Authentication Error

Summary

Every command inside Claude Code returns a 401 authentication error, including
/logout, despite the welcome screen correctly identifying the user and showing
a valid Claude Max subscription.

Environment

  • Claude Code version: 2.1.87
  • OS: macOS (Apple Silicon — MacBook Pro)
  • Shell: zsh
  • Node: (via Homebrew)
  • Authentication method: claude.ai account ([mike@goalatlas.com](mailto:mike@goalatlas.com))
  • Subscription: Claude Max

Steps to reproduce

  1. Run claude in terminal
  2. Welcome screen displays correctly: "Welcome back Mike!", Claude Max,

correct email, correct organisation

  1. Type any command — e.g. hello, run <file>, /logout
  2. Every command returns:
Please run /login · API Error: 401
{"type":"error","error":{"type":"authentication_error",
"message":"Invalid authentication credentials"},
"request_id":"req_..."}

What was tried

The following steps were attempted without resolving the issue:

  1. claude /logout — returns 401, cannot complete logout
  2. rm -rf ~/.claude — deleted stored credentials entirely
  3. Re-ran claude — welcome screen appeared again correctly, but all

commands still 401

  1. unset ANTHROPIC_API_KEY — confirmed no API key in environment
  2. npm update -g @anthropic-ai/claude-code — updated to 2.1.87
  3. Fresh terminal window — same result
  4. echo $ANTHROPIC_API_KEY — prints nothing (no key set)

Additional context

During troubleshooting, an ANTHROPIC_API_KEY was temporarily added to
~/.zshrc, which created an auth conflict warning. This was subsequently
removed and unset in the current session. The conflict warning no longer
appears, but the 401 persists.

The welcome screen data (name, subscription, email, organisation) is correct
at every attempt, suggesting the stored token is being read but rejected
when used for API calls.

Expected behaviour

Commands should execute normally once the welcome screen confirms a valid
authenticated session.

Actual behaviour

Every command, including /logout, returns 401 Invalid authentication
credentials regardless of what is typed.

What Should Happen?

Commands should execute normally once the welcome screen confirms a valid
authenticated session.

Error Messages/Logs

Every command, including `/logout`, returns 401 Invalid authentication
credentials regardless of what is typed.

Steps to Reproduce

  1. Run claude in terminal
  2. Welcome screen displays correctly: "Welcome back Mike!", Claude Max,

correct email, correct organisation

  1. Type any command — e.g. hello, run <file>, /logout
  2. Every command returns:
Please run /login · API Error: 401
{"type":"error","error":{"type":"authentication_error",
"message":"Invalid authentication credentials"},
"request_id":"req_..."}

### Claude Model

Sonnet (default)

### Is this a regression?

I don't know

### Last Working Version

_No response_

### Claude Code Version

Don't know - cannot run Claude Code

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

_No response_

View original on GitHub ↗

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