HomeClaude CodeErrors › API Error 500
OverviewInstallCLI referencePricing & limitsAgent SDKSkills & pluginsGitHubWeb, desktop & IDEModelsErrorsOpen source?TutorialFor studentsQA automationvs Cursorvs Codex & OpenCodeSubagentsHooksMCPEcosystemVS CodeOpenRouterRate limits中文指南
Last updated: September 23, 2026

Claude Code "API Error: 500": what it means and what actually fixes it

API Error: 500 {"type":"error","error":{"type":"api_error","message":"Internal server error"}} is the model side of the API failing to answer. It is the most reported error in Claude Code's history — a search of the anthropics/claude-code issue tracker for "API Error: 500" returns 881 issues, and new ones are still being filed every week. Almost never your fault; almost always fixable in under a minute.

TLDR

  • 500 = the API failed internally. Your key, prompt and config are fine.
  • Check status.claude.com first — during incidents hundreds of people hit it at once.
  • Resume with claude -c; if it repeats, /model to another tier (500s are often model-specific).
  • A 500 right as the context hits 0% means compaction failed: /compact or /clear, then continue.

The exact messages

API Error: 500 {"type":"error","error":{"type":"api_error","message":"Internal server error"}}
API Error: 500 {"type":"error","error":{"type":"api_error","message":"Internal server error"},"request_id":null}
[Bug] Anthropic API Error: 500 Internal Server Error

All three are the same failure. The first two are what the CLI prints; the third is the title of the auto-generated bug reports that Claude Code files through /bug, which is why the tracker has hundreds of identical ones — the most recent in this batch were filed on September 16 and September 22, 2026, the latter reporting 500s and 529s together.

Why it happens

  • Upstream incident. The most common cause by far. When Anthropic has a partial outage, every user of a model sees 500s at the same time — the January 2026 wave in #9066 was answered by Anthropic staff with a single link: the status page.
  • One model degraded, others fine. 500s are frequently per-model. In #3127 the top-voted fix was simply switching from Opus to Sonnet; the same session then worked.
  • Context exhausted, compaction failed. The original #3127 report hit the 500 "when the remaining context left is at exactly 0% and Claude Code has failed to auto-compact". An oversized request can surface as a 500 instead of the cleaner Prompt is too long 400.
  • A specific request shape the backend chokes on. Rarer; #91801 reproduced 500s tied to certain prompt prefixes. If one message reliably 500s and others don't, change that message.

Fixes, in the order to try them

  • 1. Look at status.claude.com. If there's an incident, nothing on your side will help — wait it out.
  • 2. Resume, don't restart: claude -c continues the last session; the half-finished turn is retried.
  • 3. Switch tier for the current task: /model → Sonnet if you were on Opus/Fable, or the reverse. Capacity and failures are per model.
  • 4. If the context meter was near 0%: /compact (or /clear and re-brief), then continue. Moving to a (1M) model variant also works.
  • 5. Update: claude update. Several 500-adjacent bugs have been fixed client-side over time.
  • 6. Still failing on one specific message? Rephrase or split it — a request-shape 500 is deterministic.
claude -c              # resume the session
/model claude-sonnet-5 # inside the session: another tier
/compact               # if the context was exhausted
claude update          # latest CLI

500 vs 529 vs 429

  • 500 — the server failed. Retry, switch model, check status.
  • 529 — the server is up but at capacity (overloaded_error). See the overloaded guide.
  • 429 — *you* exceeded a limit. See rate limits.
  • 400 — the request itself was rejected. See API Error 400.

Why gateways see fewer of them

A 500 from one upstream account is a single point of failure only if you have one upstream account. This gateway pools several and fails a request over to another when one returns 500 or 529, so most transient 500s never reach your terminal. A real, provider-wide incident still does — nobody can route around the model being down. Point Claude Code at it with ANTHROPIC_BASE_URL=https://aiprimetech.io and a gateway key.

Frequently asked questions

What does Claude Code API Error 500 mean?

The Claude API failed internally while answering ({"type":"api_error","message":"Internal server error"}). It is a server-side error, not a problem with your key or configuration.

How do I fix API Error: 500 in Claude Code?

Check status.claude.com, resume with claude -c, switch model tier with /model, and /compact if the context was nearly full. Update with claude update if it persists.

Why do I keep getting 500 errors from Claude?

Usually an ongoing upstream incident or a degraded model. If only one message triggers it every time, the request itself is the problem — rephrase or split it.

Is Claude down when I get error 500?

Often, yes — at least one model is. The status page and the GitHub issue tracker both light up within minutes during an incident.

Run Claude Code on the gateway

Same models, two environment variables, credits at 7.69× face value — or a flat-rate unlimited plan.

Get an API key See unlimited plans

AI Prime Tech is an independent API gateway and is not affiliated with, endorsed by, or sponsored by Anthropic. “Claude” and “Claude Code” are trademarks of Anthropic. Claude Code features described here follow Anthropic’s public documentation at the time of writing and change frequently; prices and model lists on this page are read from this gateway’s live settings.

More Claude Code guides

Claude Code errors and how to fix themClaude "Overloaded" error (API Error 529): what it means and what to doClaude Code API Error 400: prompt is too long, tool use concurrency, and the restClaude Code OAuth errors: timeout of 15000ms exceeded, and status code 500"Claude Code process exited with code 1": how to find the real error and fix it