`claude --bare -p` reports 'Not logged in' even when authenticated
Environment
- Claude Code version:
2.1.114 - OS: macOS (Darwin 25.4.0)
- Shell: zsh
Description
The --bare flag causes claude -p to fail with Not logged in · Please run /login, even though the same session is authenticated and claude -p (without --bare) works correctly.
Reproduction
$ claude --bare -p "list down all tools and skills you can access"
Not logged in · Please run /login
$ claude --bare -p "list down all tools and skills you can access" --verbose
Not logged in · Please run /login
$ claude -p --bare "list down all tools and skills you can access"
Not logged in · Please run /login
# Without --bare, same shell, same moment — works fine:
$ claude -p "list down all tools and skills you can access"
## Tools
... (full normal response)
claude --version and /login status confirm the CLI is installed and the user is logged in.
Expected
--bare should run the prompt using the existing authenticated session, just like claude -p does, or — if --bare intentionally disables credential loading — the error message should say so explicitly (e.g. "--bare disables stored credentials; pass ANTHROPIC_API_KEY") rather than the misleading "Not logged in · Please run /login".
Actual
Auth check fails and the user is told to /login, which does nothing to fix it because they are already logged in.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗