[BUG] macOS Authentication Loop - "Missing API key · Run /login" endless cycle

Resolved 💬 3 comments Opened Sep 27, 2025 by CrookedFerrett Closed Oct 1, 2025

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?

  • Problem: Claude Code shows "Missing API key · Run /login" repeatedly.

Running /login completes successfully but immediately returns to the same
error message - creating an endless authentication loop.

  • Platforms affected: macOS, both local terminal and SSH sessions
  • What I've tried:
  • Multiple complete reinstalls (npm global, npx, native installer)
  • Cleared all caches (npx clear-npx-cache, removed ~/.claude)
  • Keychain unlock (security unlock-keychain)
  • Different terminal applications
  • Various shell configuration changes
  • Duration: Issue persists across multiple days/sessions
  • Support status: Emailed support days ago with no response
  • Impact: Cannot use Claude Code at all due to authentication failure
  • Environment:
  • macOS version: [macOS Sequoia Version 15.7 (24G222)]
  • Claude Code version: [claude-sonnet-4-20250514]

This appears to be the same issue reported in GitHub issues #5515, #5225,
affecting multiple macOS users.

What Should Happen?

  • Fix the macOS keychain integration so authentication tokens persist

properly

  • Ensure SSH sessions can access stored authentication credentials
  • Provide alternative authentication method if keychain integration

cannot be fixed

Error Messages/Logs

Steps to Reproduce

  1. Install Claude Code on macOS (any method: npm global, npx, or native

installer)

  1. Run claude command in terminal
  2. When prompted with "Missing API key · Run /login", type /login
  3. Complete the OAuth authentication flow in browser (authentication

succeeds)

  1. Return to terminal - still shows "Missing API key · Run /login"
  2. Repeat step 3-5 - creates endless loop

Alternative reproduction:

  1. SSH into macOS machine with Claude Code installed
  2. Run claude command
  3. Observe immediate "Missing API key · Run /login" error
  4. Follow steps 3-6 above

Expected after step 4: Authentication should persist and Claude Code
should work normally

Actual result: Authentication never persists, requiring infinite
re-authentication attempts

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

1.0.128

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

!Image

View original on GitHub ↗

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