The messages
API Error: Connection dropped (ECONNRESET)
API Error: Connection lost mid-response
API Error: fetch failed
Unable to connect to API (ConnectionRefused)
Retrying in 0s · attempt 1/10
Waiting for API response · will retry in 2m 35s · check your network
API Error: Socket is closed
SSL certificate verification failed: unable to get local issuer certificate
Error: certificate has expired (CERT_HAS_EXPIRED)
Is it you or them? A two-minute check
curl -sS -o /dev/null -w "%{http_code} %{time_total}s\n" https://api.anthropic.com/v1/models -H "x-api-key: x" -H "anthropic-version: 2023-06-01"
# 401 in under a second = network path is fine, the problem is upstream or in Claude Code
# timeout / SSL error / 000 = the problem is on your side of the wire
env | grep -i -E "proxy|anthropic|node_extra|ssl"
claude --debug # per-request timing and retry reasons in the log
If curl gets a fast 401 and there are no proxy variables, you are almost certainly looking at an upstream incident. That is the population in #87424 (open: intermittent ECONNRESET on the desktop app and the CLI, no VPN, no proxy, from August 13, confirmed by several people through August 21) and #86473 (persistent ECONNRESET on all surfaces while raw HTTP to the API works). Nothing local fixes those; retries and time do. Check status.claude.com, and if several people report the same hour on the tracker, stop debugging.
"Waiting for API response · check your network"
The message blames your network, and often it is wrong about that. #82155 (open, 15 reactions): multi-minute stalls all day with the retry backoff reaching over two minutes on a network that was demonstrably fine. #76555 (open): the wait on every single reply across models. #72059 and #70534: the same stall specifically when the advisor model is consulted, then a normal answer after the timer. The backoff is exponential, so the visible damage is the wait, not the failure; the variables below shorten it.
Retry and timeout variables
export CLAUDE_CODE_MAX_RETRIES=15 # default 10, capped at 15
export CLAUDE_CODE_RETRY_WATCHDOG=1 # keep retrying instead of giving up (unattended runs)
export API_TIMEOUT_MS=600000 # per-request timeout, default 10 minutes
export CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS=60000 # give up on a silent stream sooner and retry
export CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY=2 # fewer parallel streams on a flaky link
A lower first-byte timeout is the one that changes the feel of a flaky connection: instead of waiting the full ten minutes on a stream that will never answer, the client abandons it and retries. Lower tool-use concurrency helps on links that drop when several streams run at once (mobile hotspots, some VPNs).
Proxies, VPNs and corporate networks
- Set the proxy variables Claude Code reads:
HTTPS_PROXY(andHTTP_PROXY,NO_PROXY). A proxy that only exists in the browser or in npm config is invisible to the CLI. - TLS-inspecting proxies replace Anthropic's certificate with their own: that is
unable to get local issuer certificate. Export the corporate root CA to a PEM file and setNODE_EXTRA_CA_CERTS=/path/to/corp-root.pem. Do not disable verification. - `CERT_HAS_EXPIRED` on the native build (#71727, 2.1.19x): the bundled trust store, not your clock.
claude update; if stuck, the npm build uses the system store. - `ConnectionRefused` on macOS after a reinstall (#75897) — a local proxy or VPN client that is off, but still configured in the environment; clear the proxy variables and system proxy settings, then retry.
- VPN exit changes mid-session reset every open stream: expect one ECONNRESET per reconnect.
Through a gateway
Point Claude Code at a gateway (ANTHROPIC_BASE_URL=https://aiprimetech.io) and the network path changes: the client talks to the gateway, and the gateway holds the upstream connections and retries a saturated account on another. It does not make a broken local network work, but for the *upstream reset* population above it removes the single-account dependency, and the same key keeps working through a subscription incident. Run the curl check against the gateway host to confirm the path before switching.
export ANTHROPIC_BASE_URL=https://aiprimetech.io
export ANTHROPIC_API_KEY=your_gateway_key
claudeTired of fighting this one?
Run Claude Code through the AI Prime Tech gateway instead: the same Claude models on the gateway's own upstream accounts, two environment variables to switch, and new accounts get $5 in free API credit with code FIXIT — no card.
export ANTHROPIC_BASE_URL=https://aiprimetech.io
export ANTHROPIC_API_KEY=your_keyFrequently asked questions
How do I fix 'API Error: Connection dropped (ECONNRESET)' in Claude Code?
Run curl against the API: if it answers quickly and you have no proxy, the reset is upstream; let the retries run, check status.claude.com. If curl also fails, fix the proxy variables, VPN or CA certificate.
What does 'Waiting for API response · will retry in … · check your network' mean?
Claude Code got no answer from the API within the timeout and is backing off before retrying. Despite the wording it is often not your network; lower CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS so the client abandons silent streams sooner.
How do I fix 'unable to get local issuer certificate' in Claude Code?
A proxy is re-signing TLS. Export the corporate root certificate as PEM and set NODE_EXTRA_CA_CERTS to that file. Never disable certificate verification.
What does 'Retrying in 0s · attempt 1/10' mean?
A request failed and Claude Code is retrying; the default is 10 attempts with growing delays, CLAUDE_CODE_MAX_RETRIES raises it to 15 and CLAUDE_CODE_RETRY_WATCHDOG=1 keeps retrying for unattended runs.
Run Claude Code on the gateway
Same models, two environment variables, credits at 7.69× face value — or a flat-rate unlimited plan. New accounts: $5 in free API credit with code FIXIT.
Get an API key See unlimited plansAI 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.