Claude Code error
Claude Code: API Error: 500 Internal server error
API Error: 500 Internal server error. This is a server-side issue, usually temporaryStatus: WorkaroundLast verified 4 documented fixes4 sources
What it means
The Claude API (or the provider behind your endpoint) returned a 5xx response. Per the official error reference, a 5xx from the API indicates an unexpected failure inside the API and is not caused by your prompt, settings, or account. Older versions printed the raw JSON form: API Error: 500 {"type":"error","error":{"type":"api_error","message":"Internal server error"}}.
Causes
- An unexpected failure inside the API or the inference provider (Anthropic API, Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry, or a custom gateway)
- A proxy, load balancer, or gateway answering with an HTML error page, shown as for example API Error: 502 Bad Gateway
- Short-lived service incidents: on issue #3127 an Anthropic contributor replied "We had a brief increase in errors, this should be resolved now!" and closed it
How to fix it
- Fix 1.
Check status.claude.com, or the provider status page named in the message, for active incidents.
- Fix 2.
Wait a minute, then send your message again. Your original message is still in the conversation, so for a long prompt you can type try again instead of pasting it again.
Snippettry again - Fix 3.
If ANTHROPIC_BASE_URL points at an LLM gateway and every request fails this way, check that your gateway and its upstream accept tool search fields: by default Claude Code sends defer_loading tool fields and tool_reference blocks, with the anthropic-beta header that enables them. Before v2.1.304, tool search was off behind a gateway unless you turned it on with ENABLE_TOOL_SEARCH.
- Fix 4.
If the error persists with no posted incident, run /feedback so Anthropic can investigate with your request details.
Slash command/feedback
More Claude Code errors
All 18 Claude Code errorsAPI Error: Repeated 529 Overloaded errors. The API is at capacityStatus: WorkaroundAPI Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01FRvEykWmCgrgJ22mvBbKhV. Each `tool_use` block must have a corresponding `tool_result` block in the next message."}}Status: OpenUnable to connect to API. Check your internet connectionStatus: WorkaroundUnable to connect to API: SSL certificate verification failed (UNABLE_TO_GET_ISSUER_CERT_LOCALLY).Status: WorkaroundPlease run /login · API Error: 401 OAuth token has expiredStatus: WorkaroundOAuth error: timeout of 15000ms exceededStatus: OpenPrompt is too longStatus: WorkaroundYou've hit your session limit · resets 3:45pmStatus: By design
Related reading
- AI-Generated Code and Technical Debt: Is Your Codebase Fragile?A viral essay argues AI-written code makes codebases fragile: shallow tests, needless complexity, lost understanding, no time to review. What holds up, what is anecdote, and four checks to run on your own repo.
- Claude Fable 5.2: What Changed, Pricing and How to MigrateClaude Fable 5.2 costs $8/$40 per MTok, down from $10/$50, but enforces the prefix check on every account. The four breaking changes and how to migrate.
- Goldman Sachs Restricts Claude Code to Engineers OnlyGoldman Sachs limited Claude Code and GitHub to engineers in October. What Bloomberg reported, what it signals for banks and regulated teams, and a rollout checklist for your own org.
- Claude Code settings.local.json Secrets: Check Your ReposApiiro found real secrets in 1,122 public Claude Code settings.local.json files saved by Yes, and don't ask again. What the file stores, what Anthropic said, and a 10-minute cleanup.
- Claude Code denyInsteadOfPrompting: Deny Permission Prompts EverywhereClaude Code 2.1.319 adds permissions.denyInsteadOfPrompting: any call that would wait on a permission prompt is denied and the turn carries on, subagents included.
- Conductor Joins Meta: Shutdown Dates and AlternativesConductor is joining Meta. Cloud goes read-only Nov 13 and shuts down Nov 20, and the local Mac app winds down in early 2027. The dates, what to export, and what to move to.
FAQ
What does "API Error: 500 Internal server error" mean in Claude Code?
The Claude API (or the provider behind your endpoint) returned a 5xx response. Per the official error reference, a 5xx from the API indicates an unexpected failure inside the API and is not caused by your prompt, settings, or account. Older versions printed the raw JSON form: API Error: 500 {"type":"error","error":{"type":"api_error","message":"Internal server error"}}.
How do I fix "API Error: 500 Internal server error"?
There are 4 documented fixes. Start with the first: Check status.claude.com, or the provider status page named in the message, for active incidents.
Is this Claude Code error fixed?
Status: Workaround. No release removes the cause. The documented fixes work around it. Affected versions: All versions (server-side). Before v2.1.281 the status code was dropped when a proxy HTML error page had a title. v2.1.108 added a status.claude.com link to 5xx/529 errors.
Sources
Last verified against 4 sources: official docs, maintainer replies and release notes.
Newsletter
Fixes for the tools you use, weekly
One email per week. New coding agent releases, what broke, and how developers are working around it.