Claude Code · tool · fg-0480

claude --bare -p fails to authenticate although the normal session is signed in with Pro or Max

If you see A --bare run fails on authentication while the same command without --bare works, the cause and the fix for Claude Code are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
A --bare run fails on authentication while the same command without --bare worksCI job that relies on a subscription login breaks after adding --bare
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"}'
Affected
Claude Code --bare mode, as of 2026-10
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun