--bare auth failure says "Please run /login" but /login cannot fix it — message should point to ANTHROPIC_API_KEY

Open 💬 0 comments Opened Jul 3, 2026 by DanielleFong

Summary

Not relitigating the design settled in #51047 / #60155 — bare mode intentionally never reads OAuth/keychain, and the 2.1.200 --help text now documents this clearly:

Anthropic auth is strictly ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth and keychain are never read).

The remaining problem is narrow: when auth fails under --bare, the error message is

Not logged in · Please run /login

/login cannot fix this — OAuth credentials are never read in bare mode, so a user who follows the instruction lands right back on the same error. The message actively misdirects.

Version / environment

  • Claude Code 2.1.200 (native installer), macOS (Darwin)
  • Logged in via OAuth (valid keychain credentials)

Repro

| Command | Result |
|---|---|
| claude -p "reply with exactly: OK" (OAuth only) | ✅ OK, exit 0 |
| claude --bare -p "reply with exactly: OK" (OAuth only) | ❌ Not logged in · Please run /login, exit 1 |
| ANTHROPIC_API_KEY=… claude --bare -p "reply with exactly: OK" | ✅ OK, exit 0 |

(API-key auth under --bare works correctly in 2.1.200 — the failure mode from #60155 appears resolved.)

Suggested fix

When CLAUDE_CODE_SIMPLE=1/--bare is active, replace the auth-failure message with something like:

Not authenticated · Bare mode requires ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth/keychain are not read in --bare)

View original on GitHub ↗