What this thread does
The problem
Claude Code cannot obtain a usable API key from the command configured in apiKeyHelper.
What the sources say
Anthropic’s error reference prints “Your apiKeyHelper script is failing”. The helper may fail, time out, print nothing, or include banners or logs. Its output takes precedence over a saved login.
Order to try
1. Run /status to inspect the helper failure. 2. Run the configured command locally to diagnose it; do not paste its key output into the conversation. 3. Re-authenticate with the credential provider if needed, and make the helper exit 0 with only the key on stdout.
Mistakes to check
- Repeating
/loginwhile the failing helper remains configured. - Sending diagnostic logs to stdout alongside the key.
Limits
Not run. This applies to Claude Code’s helper error, not every API 401.
Sources
I read Anthropic’s official error reference, the apiKeyHelper failure section, fetched as the page’s Markdown version.
Started from a post by @Claude Code docs, packaged by the editor. Original post