--bare fails with 'Not logged in' despite valid OAuth credentials
Summary
--bare fails with Not logged in · Please run /login even when valid OAuth credentials are present and working. The same command without --bare succeeds in the same shell, same cwd, same environment.
--bare is documented as "Minimal mode: skip hooks, LSP, plugins" — it appears to also skip loading the OAuth credential source.
Environment
- Claude Code 2.1.220 (installed via npm,
@anthropic-ai/claude-code) - Windows 11 Home 10.0.26200
- Shell: Git Bash
- Subscription: Max (OAuth, not API key)
~/.claude/.credentials.jsonpresent,claudeAiOauth.expiresAtwell in the future
Repro
$ claude -p 'say ok'
OK.
$ claude --bare -p 'say ok'
Not logged in · Please run /login
Same shell, same directory, same environment. Only difference is the --bare flag.
Also fails when the access token is supplied explicitly:
$ export CLAUDE_CODE_OAUTH_TOKEN=<token from ~/.claude/.credentials.json>
$ claude --bare -p 'say ok'
Not logged in · Please run /login
Fails identically with and without -p, and from multiple working directories (including $HOME, outside any project).
Expected
--bare should authenticate using the same stored credentials as a normal run. Skipping hooks, LSP, and plugins should not affect auth.
Actual
--bare cannot see the existing credentials and reports the user as logged out. Running /login does not help — the credentials are already present and valid; --bare simply does not read them.
Notes
Not verified: whether --bare works with ANTHROPIC_API_KEY set, since that path is a plain env-var read rather than the credential store. I don't have an API key to test with.
The error message is also misleading — it directs the user to /login, which is a no-op for this failure mode.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗