Invalid API key (invalid x-api-key)

The key in the environment or keychain was rejected outright.

99 issues · 6 open · 93 resolved (94%) · first seen Mar 12, 2025

First response · account

What to do now

Most likely: Authentication, usage state or session size blocked the request.

  1. Check the exact account, organization and usage window currently selected.
  2. Try a new short session before deleting credentials or local history.
  3. If the state is inconsistent across machines, preserve diagnostics and re-authenticate once.

These are conservative triage steps, not an official Anthropic fix. Use the issue and workaround evidence below before making a destructive configuration change.

Is this getting better or worse?

This class of problem is holding steady. 9 new reports in the last 90 days vs 9 in the 90 before — 0%. The open backlog peaked at 32 in 2025-10 and sits at 6 today.

0 8 16 24 32 2025-032025-092026-032026-08
2025-03 — First reports2025-08 — Most new reports (28)2025-10 — Peak backlog (32 open)

Derived by counting each matching issue from its creation date until it closed. First-party computation over the anthropics/claude-code tracker — the trend is not published anywhere upstream.

Which builds report this

18 of these reports name the Claude Code build they were running, spanning 18 releases. Heaviest reporters:

Report volume, not a defect count: an issue can mention a build without that build having caused the failure. Versions come from the version string in the bug-report template, matched against real published tags.

Do these get fixed?

Median time to close is 14 days across 93 closures. Of the 93 closures with a recorded reason, 30% were closed as completed and 65 as not-planned or duplicate. The most recent completed fix landed in 2026-08.

Workarounds reported by the community

18 of these issues post a workaround someone says worked. The highest-engagement ones:

[BUG] Sessions become unresponsive after upgrade to 2.0.60 (suspected background agent blocking)
…tatic for at least an hour, until I got the idea to re-log. Workaround: None found, except to log out of anthropic and back in. Related but different issues found: - - Agent freeze but with 100% CPU (yours is silent) - -…
Found in the description of #13188 · resolved
Authentication Failure After Login in v1.0.68 at ssh remote
…y" error, requiring repeated (unsuccessful) login attempts. Workaround: Downgrading to version 1.0.67 resolves the issue: Environment(remote machine): - Node.js version: v20.18.1 - npm version: 10.8.2 - Operating System:…
Found in the description of #5118 · resolved
[BUG] Missing API key · Run /login on Max subscription
…e are no new API keys created in my Anthropic account. Temp workaround : I got this working on the new machine by copying the following files/directories from the old (working) device to the new device: This uses the sam…
Found in the thread of #5166 · resolved
Invalid API key · Please run /login
…e are no new API keys created in my Anthropic account. Temp workaround : I got this working on the new machine by copying the following files/directories from the old (working) device to the new device: This uses the sam…
Found in the thread of #5167 · still open
[BUG] Authentication fails immediately after successful /login in Claude Code v1.0.71
…on history - Issue persists even after cleaning config file Workarounds Attempted - Multiple /login attempts - Unsetting ANTHROPIC API KEY environment variable - Resetting project-specific configuration - Removing and re…
Found in the description of #5369 · resolved

Excerpts are quoted from the linked issue so you can judge relevance before opening it. Threads that only ask for a workaround, or report that there is none, are excluded. These are community suggestions, not official guidance from Anthropic — read the full thread before applying one.

Matching issues 1–99

Ranked by community engagement (reactions weighted over comments).

Related aggregations

  1. Claude usage limit reached

    173 issues
  2. Auto-compact / compaction failed

    379 issues
  3. OAuth token expired / refresh failed

    344 issues
  4. Prompt is too long (context window exceeded)

    322 issues
  5. Your credit balance is too low

    76 issues
  6. API Error 400 (invalid_request_error)

    2,591 issues