Claude Code · tool · fg-0480
claude --bare -p fails to authenticate although the normal session is signed in with Pro or Max
A --bare run fails on authentication while the same command without --bare works
Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100
Cause
Bare mode never reads OAuth credentials or the system keychain, so a Claude subscription login is not used. Amazon Bedrock, Google Cloud, and Microsoft Foundry keep reading their own credentials.
Fix
Set ANTHROPIC_API_KEY to a key created in the Claude Console, or supply an apiKeyHelper in the --settings JSON.
Apply
claude --bare -p "task" --settings '{"apiKeyHelper": "~/bin/get-anthropic-key.sh"}'Affects: Claude Code --bare mode, as of 2026-10
Sources
Have your agent know this before it fails
claude mcp add --transport http footgun https://getfootgun.com/api/mcp