Claude Code · Errors

Claude Code Common Errors and Fixes

First find the matching entry below by the raw error message, then look at the cause and resolution steps. Most issues come down to the key, environment variables, or the API endpoint. After changing anything, restart Claude Code and run /status to confirm.

Last checked

Error Message Index

The error messages below were tested on Claude Code 2.1.299.

Error message (excerpt)MeaningJump to
API Error: 400 ... 模型 xxx 不存在或未上线Model name is unavailableSee "400"
Failed to authenticate. API Error: 401Key entered incorrectlySee "401 Authentication"
Failed to authenticate. API Error: 403 此 API Key 已被停用Key has been deactivated or deletedSee "403 Key Deactivated"
Not logged in · Please run /loginKey not configuredSee "Not logged in"
当前并发请求过多,请稍后重试Concurrency exceeded (HTTP 429)See "429 Rate Limit"
API Error: 529 ... overloaded_errorModel is busySee "overloaded"
API Error: Connection dropped (ECONNRESET)Endpoint unreachable or domain is wrongSee "Timeout / Connection Dropped"
There's an issue with the selected model (...)API endpoint is wrongSee "Third-Party API Issues"

400

Claude Code
API Error: 400 {"error":"模型 xxx 不存在或未上线,请前往 https://aicodewith.com/zh/dashboard/pricing 查看可用模型列表 (request_id: …)"}
  • Model name is misspelled or the model is unavailable: run /model to choose again, or check the model ID on the model page.
  • Context is too long: run /compact to compress the conversation, or /clear to start a new session.

401 Authentication

Claude Code
Failed to authenticate. API Error: 401 {"error":"请在请求中提供有效的 API Key。"}
  1. Copy the key again from the dashboard, check for leading/trailing spaces and newlines, and make sure the key hasn't been deleted.
  2. Put the key in ANTHROPIC_AUTH_TOKEN and leave ANTHROPIC_API_KEY empty.
  3. In a new terminal, run echo $ANTHROPIC_API_KEY and remove old values in ~/.zshrc or ~/.bashrc.
  4. Close all Claude Code sessions and reopen, then run /status.

403 Key Deactivated

Claude Code
Failed to authenticate. API Error: 403 此 API Key 已被停用,如有疑问请联系我们 https://aicodewith.com/zh/contact

After the key is deactivated or deleted, this error appears within seconds. Check the key status in the dashboard, create a new key, and update your configuration; contact us if you have any questions.

Not logged in

Claude Code
Not logged in · Please run /login

This means the key is empty or not configured; it doesn't mean you need to log in to a Claude account. Fill in the key in ANTHROPIC_AUTH_TOKEN in ~/.claude/settings.json and restart Claude Code.

429 Rate Limit

HTTP 429
{"error":"当前并发请求过多,请稍后重试 (request_id: …)"}

(This error was reproduced with concurrent curl requests; the display inside Claude Code may differ.)

Pay-as-you-go has no 5-hour or weekly quota, but rate and concurrency limits still apply. When too many requests are sent at once, the excess requests return 429; wait a moment and retry.

  • Close extra Claude Code sessions and reduce parallel subagents; scripts and CI jobs that share the same key also count.
  • Create a separate key for each person or pipeline so it's easier to identify the source.

overloaded

Claude Code
API Error: 529 {"type":"error","error":{"type":"overloaded_error","message":"Overloaded"}}

The request and key are fine; the model is simply busy at that moment. The spike is usually short and only affects a specific model.

  • Wait a moment and resend; the conversation won't be lost.
  • Run /model to switch to a different model (for example, from Opus to Sonnet) to get the work done first.
  • Check the channel status on the model page and, if necessary, switch the key to a different channel.

Timeout / Connection Dropped (ECONNRESET)

Claude Code
API Error: Connection dropped (ECONNRESET)

This error appears when the API endpoint is unreachable or the domain is wrong.

  • Run /status to confirm the API endpoint is api.aicodewith.ai, not the default Anthropic address.
  • Temporarily disable your local proxy or VPN and try again; connections from China can work directly.

When the key is wrong or the network is unreachable, Claude Code retries automatically for about 3–4 minutes, during which the interface stays blank with no message. If it hangs for a long time, check the key and endpoint first.

Third-Party API Issues (Base URL, Configuration Not Applied)

Claude Code
There's an issue with the selected model (...). It may not exist or you may not have access to it. Run --model to pick a different model.

If ANTHROPIC_BASE_URL is set to https://aicodewith.ai, or has an incorrect path (like /foo), you'll get this error. It looks like a model problem, but the endpoint is actually wrong; use https://api.aicodewith.ai instead.

Environment variables take precedence over ~/.claude/settings.json: old values exported in your terminal will override the config file. After changing any configuration, close all Claude Code sessions (including VS Code and JetBrains plugins) and reopen. The standard configuration is:

~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "你的_API_KEY",
    "ANTHROPIC_API_KEY": "",
    "ANTHROPIC_BASE_URL": "https://api.aicodewith.ai"
  }
}
  • ANTHROPIC_BASE_URL should not include /v1 or a trailing slash.
  • If the first run gets stuck on the login page, add "hasCompletedOnboarding": true in ~/.claude.json.

Claude Code Integration GuideClaude Code Relay SetupClaude Haiku API Error Troubleshooting

FAQ

Is overloaded caused by my setup?

No. A 529 overloaded response means the model is busy at the moment and is unrelated to your key or configuration. Retry later, or switch to another model or channel.

How do I see the full error?

Claude Code prints the raw API Error in the conversation; starting it with claude --debug shows more detailed request logs. When troubleshooting, note the raw error and the /status output.

It says Not logged in · Please run /login. Do I need to log in to a Claude account?

No. This means the key is empty or not configured. Put the key in ANTHROPIC_AUTH_TOKEN and restart Claude Code.

Can switching to an API relay fix 429?

If the 429 comes from the 5-hour or weekly quota on Anthropic's plan, switching to a pay-as-you-go API after the quota is used up means you are no longer bound by that quota. However, pay-as-you-go still has concurrency limits, and excessive concurrency returns “当前并发请求过多,请稍后重试”.

What should I do if it hangs for a long time?

If the key is wrong or the network is unreachable, Claude Code retries automatically for about 3–4 minutes, during which the interface stays blank. If it has been a long time with no response, check the key and endpoint first.

What if configuration changes don't take effect?

Check whether you have exported old environment variables in the terminal (they take precedence over settings.json), then close all Claude Code sessions and reopen, and run /status to confirm the endpoint.

Ready to try it?

Billing is per token from a prepaid balance. Rate and concurrency limits apply, and you can set daily, monthly or total spend caps on each API key.

Related

AICodeWith is an independent third-party API service and is not affiliated with Anthropic or OpenAI. Claude, Claude Code, Codex, and other names belong to their respective owners. Pricing is subject to real-time data on the model page; rate and concurrency limits apply; refunds are subject to a 10% processing fee. See the refund policy for details.