Short answer: find your message in the table below. Most Claude Code API errors are temporary, and Claude Code has already retried them up to 10 times before you see one. Three checks solve most of the rest: /status (which login or key is in use), curl -I https://api.anthropic.com (can your computer reach Anthropic at all) and status.claude.com (is it Anthropic's side).
Everything below is from Anthropic's Claude Code error reference, checked on October 29, 2026, with the messages word for word so you can match them. (I build Morphy, which runs Claude Code next to other AIs; it gets one line near the end.)
Find your error
| The message starts with | What it means | Fix |
|---|---|---|
Unable to connect to API | Your computer can't reach Anthropic | Connection errors |
Connection dropped (ECONNRESET) | The connection broke mid-request | Connection errors |
Connection refused | A firewall, proxy or leftover setting blocks it | Connection errors |
Request timed out | No answer before the deadline | Connection errors |
API Error: 500 Internal server error | A failure inside Anthropic's API | Server errors |
API Error: Repeated 529 Overloaded errors | Anthropic is at capacity | The 529 guide |
Request rejected (429) | The rate limit on your API key or cloud project | Limits |
You've hit your session limit | Your plan's usage limit | Limits |
Not logged in · Please run /login | No valid login for this session | Sign-in errors |
Invalid API key | The key in ANTHROPIC_API_KEY was rejected | Sign-in errors |
API Error: 401 Invalid authentication credentials | The account or key behind the login was rejected | Sign-in errors |
Login expired / OAuth token has expired | Your saved login couldn't be renewed | Sign-in errors |
There's an issue with the selected model | The model name is wrong, or your account can't use it | Model errors |
Claude Opus is not available with the Claude Pro plan | Your plan doesn't include that model | Model errors |
Prompt is too long / Context limit reached | The conversation is bigger than the model's context | Model errors |
Connection errors
Claude Code names the kind of failure and keeps the code in brackets:
Unable to connect to API. Check your internet connection
Connection refused — a firewall or proxy may be blocking it (ConnectionRefused)
Can't reach the API server — check your internet or DNS (ENOTFOUND)
No internet route — check your connection or VPN (EHOSTUNREACH)
Couldn't connect through your proxy (ERR_PROXY_TUNNEL)
Connection dropped (ECONNRESET)
Request timed out. Check your internet connection and proxy settings
(Older versions wrote them as Unable to connect to API (ECONNRESET) and so on.) The usual causes are no internet, a VPN that blocks api.anthropic.com, or a company proxy that Claude Code doesn't know about.
- Test the connection from the same terminal:
curl -I https://api.anthropic.com. In PowerShell, typecurl.exe -I https://api.anthropic.com, so Windows doesn't run its owncurlalias instead. - Behind a company proxy? Set
HTTPS_PROXYbefore you start Claude Code. curlworks but Claude Code doesn't? Look for a leftoverANTHROPIC_BASE_URL:echo $ANTHROPIC_BASE_URL, orecho $env:ANTHROPIC_BASE_URLin PowerShell, and theenvblock of your settings files. If it points at a local proxy or gateway that's no longer running, every request fails withConnection refused. Remove it and open a new terminal.- Still failing? On Linux and WSL, check
/etc/resolv.conffor a broken nameserver. On a Mac, an uninstalled VPN can leave a network interface behind. Docker Desktop and similar tools can intercept traffic: quit them and try again.
ECONNRESET and other one-off drops are retried by themselves, so if you only see them now and then, there's nothing to fix.
Request timed out on its own means the API didn't answer before the deadline, 10 minutes by default. Try again. On a slow network or proxy, raise API_TIMEOUT_MS (in milliseconds).
Socket is closed means a connection closed while the answer was still arriving, most often a company proxy on Windows dropping it. Claude Code retries, keeps what Claude had already written, or ends the turn, depending on how far it got.
Server errors
API Error: 500 Internal server error. This is a server-side issue, usually temporary — try again in a moment. If it persists, check https://status.claude.com.
An unexpected failure inside Anthropic's API, not caused by your prompt, settings or account. Check status.claude.com, wait a minute and send try again: your original message is still in the conversation. If it keeps happening with no incident posted, run /feedback so Anthropic can look at your request.
A proxy or gateway in between can answer with its own page instead, such as API Error: 502 Bad Gateway.
529 Overloaded is its own case, with its own fixes (switching models helps, because capacity is tracked per model): see Claude Code's 529 Overloaded error.
Rate limits and usage limits
API Error: Request rejected (429) · this may be a temporary capacity issue. If it persists, check https://status.claude.com.
You've hit the rate limit on your API key, Amazon Bedrock project or Google Cloud project. Run /status first: a stray ANTHROPIC_API_KEY in your environment can send requests through a low-tier key instead of your subscription. Then check your provider's limits, or run fewer agents and subagents at once.
API Error: Server is temporarily limiting requests (not your usage limit)
A short throttle on Anthropic's side, retried by itself. Wait briefly and try again.
You've hit your session limit · resets 3:45pm
This one is your plan's usage limit. Wait for the time it shows, or keep going another way: Claude Code's usage limits covers what counts and how to make a plan last longer.
Sign-in errors
Not logged in · Please run /login
No valid login for this session: run /login. If you expected an API key to sign you in, check that ANTHROPIC_API_KEY is set in the same terminal you started claude from. In the desktop app, the message reads Authentication required · Sign in again to continue.
Invalid API key · Fix external API key
The API rejected the key in ANTHROPIC_API_KEY, or Claude Code found a character in it that can't be sent (like a line break). Check the key in the Claude Console, and look for a stale one loaded from a .env file: env | grep ANTHROPIC, or Get-ChildItem Env:ANTHROPIC* in PowerShell. To use your subscription instead, unset the key and run /login.
Please run /login · API Error: 401 Invalid authentication credentials
The API recognized your login or key but rejected the account or organization behind it: revoked, disabled or deactivated. Run /status to see which one is in use. If it's an API key, it takes priority over your login, so /login won't help: remove it (unset ANTHROPIC_API_KEY, or Remove-Item Env:ANTHROPIC_API_KEY in PowerShell) or make a new one. If it's your login, run /login once; if the error comes back, ask your organization's admin.
Login expired · Please run /login
OAuth token revoked · Please run /login
Please run /login · API Error: 401 OAuth token has expired ...
Your saved login couldn't be renewed, or was signed out everywhere: run /login. In scripts and the Agent SDK the same problem reads Failed to authenticate: OAuth session expired and could not be refreshed.
Model and context errors
There's an issue with the selected model (claude-...). It may not exist or you may not have access to it. Run /model to pick a different model.
Run /model and pick from the list. Use a short name like sonnet or opus rather than a full model ID, so it doesn't go out of date. If an old model keeps coming back, it's set somewhere: an ANTHROPIC_MODEL variable or a settings file.
Claude Opus is not available with the Claude Pro plan. If you have updated your subscription plan recently, run /logout and /login for the plan to take effect.
Pick a model your plan includes with /model, or if you just upgraded, run /logout and /login.
Context limit reached · /compact or /clear to continue
The conversation and its files are bigger than the model's context window (Prompt is too long in scripts). /compact summarizes the conversation and carries on; /clear starts fresh.
Still stuck?
- Update Claude Code. Many messages above changed in recent versions, and some bugs behind them are fixed: check yours with
claude --version. - Report it with
/feedback, which sends Anthropic the details of your request. - Keep working elsewhere. If Claude is down for you, another agent can carry on: Codex runs on a ChatGPT plan, on OpenAI's servers. In Morphy, you can switch a chat to another AI and the conversation comes along.
Questions
What does "API Error" mean in Claude Code? That a request to Anthropic's API failed: a connection problem, an error on Anthropic's side, a limit, or a sign-in problem. The text after it says which.
How do I fix "Unable to connect to API (ECONNRESET)"? A one-off ECONNRESET is retried by itself. If it keeps happening, test curl -I https://api.anthropic.com from the same terminal, set HTTPS_PROXY behind a company proxy, and remove a leftover ANTHROPIC_BASE_URL.
Why does Claude Code keep asking me to /login? Your saved login expired or was revoked. If it repeats after /login, run /status: an API key in your environment may be taking priority over your login.
Is a 529 or 500 error my fault? No. Both come from Anthropic's side and don't count against your usage. See the 529 guide.
What's the difference between a 429 and a usage limit? A 429 is a rate limit on an API key or cloud project, or a short throttle. A usage limit (You've hit your session limit) is your Claude plan's allowance, and it shows when it resets.
Related guides
- Claude Code "API Error: 529 Overloaded"
- Claude Code usage limits
- How to install and use Claude Code on Windows
- The best Claude Code alternatives
References
- Anthropic: Claude Code error reference (find your error, automatic retries, server errors, usage limits, authentication, network, request errors), network configuration, model configuration, status
- Morphy: Switch to another AI




