Skip to content

Network & Connectivity

API Error (Connection error.)

Symptom: the request fails before reaching the server; retries don't help.

Cause: the local-to-server link is down (TCP connection stage failed) — usually a dead proxy node, flaky Wi-Fi routing, or a firewall blocking outbound requests.

Steps:

  1. Run ping your-request-address to check connectivity
  2. Replies → check proxy config; timeout → switch networks (other Wi-Fi / disable proxy / change proxy node / phone hotspot)
  3. Make sure your proxy app has "system proxy" or "TUN mode" on — Claude Code is a CLI tool and doesn't use the browser proxy channel
  4. Once the network recovers, run claude again

API Error (Request timed out.)

Symptom: the request times out after a while.

Two cases:

  • Case A — network latency: latency to the server is too high; follow the network steps in "API Error (Connection error.)" above
  • Case B — context too long: the session has accumulated too many tokens and processing exceeds the timeout

Case B fix:

  • Type /clear in Claude Code to clear the conversation
  • Or /compact to compress context into a summary
  • Or quit and run claude again for a fresh session

IDE note: IDE plugins inject large system prompts; combined with Claude Code's own prompt, the number of usable turns drops noticeably. If you hit timeouts, check context length first.

WebFetch (web access) not working

Symptom: WebFetch errors out, but the target site opens fine in a browser and the proxy is in global mode.

Cause: before fetching the target page, Claude Code first sends a preflight to https://claude.ai/api/web/domain_info. If domestic networks / corporate firewalls block claude.ai, the preflight fails and WebFetch errors out entirely.

Fix: add to ~/.claude/settings.json (Windows: C:\Users\<name>\.claude\settings.json):

json
"skipWebFetchPreflight": true

If you already have other config, merge it:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://your-request-address",
    "ANTHROPIC_API_KEY": "sk-***"
  },
  "skipWebFetchPreflight": true
}

Restart Claude Code to skip the preflight and request the target page directly.