Error explained
Error: connect ETIMEDOUT
ETIMEDOUT means a connection or request got no answer within the time allowed. Unlike a refusal, something is silently dropping the traffic, or the server is too slow.
4 min read12 sectionsUpdated
On this page
If the connect step hangs, check security groups, network ACLs and firewall rules for the source address, and that the IP is correct (stale DNS after a migration is common). If connecting works but the response times out, open a trace of the slow request on the server side to see where the time goes; see 504 Gateway Timeout.
Retry only idempotent requests (GET, PUT with the same body, requests with an idempotency key), use exponential backoff with jitter, and cap the attempts, or retries multiply load during an outage.
Catching it in production
Timeouts show as long, failing client spans in traces, often all to one dependency. Alert on the dependency’s error rate and p99 latency rather than on each timeout.
VitalRix error tracking groups exceptions recorded on OpenTelemetry spans into issues with counts, first and last seen, affected endpoints and versions, and marks an issue as regressed if it comes back after being resolved. Alert rules on error rate per service or endpoint route the problem to the right team before customers report it.
When the address is wrong
After a migration, stale DNS or a hard-coded IP can send traffic to an address that no longer answers, which looks exactly like a firewall drop. Log the resolved IP alongside the error, check it against the current record, and lower TTLs before planned moves. See DNS monitoring.
Find which timeout fired
ETIMEDOUT means a network operation did not finish in time. Which operation matters: connecting, or waiting for a response.
| Phase | Typical cause | What to check |
|---|---|---|
| DNS lookup | Slow or unreachable resolver | dig the host from the same machine |
| TCP connect | Firewall dropping packets, wrong IP, server overloaded | nc -vz host port, security groups |
| TLS handshake | Overloaded server, middlebox issues | openssl s_client timing |
| Waiting for the response | Slow upstream, long query, deadlock | Upstream traces and logs |
// separate the connect timeout from the overall timeout, so the error says which one fired
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(new Error('response timeout after 10s')), 10_000);
try {
const res = await fetch('https://api.example.com/orders', { signal: controller.signal });
console.log(res.status);
} finally { clearTimeout(timer); }Fixes that hold
- Set explicit timeouts on every outbound call, shorter than the timeout of whatever calls you.
- Retry idempotent requests with backoff and jitter; never retry a payment without an idempotency key.
- Reuse connections (keep-alive agents) so you do not pay the connect cost on every call.
- Watch the upstream: a rising rate of ETIMEDOUT to one host is an incident at that host. Alert on it with an API check, and see ECONNRESET and ECONNREFUSED for the related errors.
Should I just raise the timeout?
Only if the work is legitimately slow. Long timeouts tie up workers and make outages worse. Fix the slow part, or move it out of the request.
Why do timeouts happen only under load?
Pools and queues fill up, so requests wait before any work starts. Check saturation: connection pools, worker counts, CPU.
Check it now, free
- Open port checker: Is a TCP port open, closed or filtered from the internet?
Related reading
- Cloudflare error 522: connection timed out: Fix Cloudflare error 522 "Connection timed out": the origin did not complete the TCP connection in time. Overloaded servers, dropped packets and wrong DNS.
- Error: socket hang up: Why Node.js reports "socket hang up", from servers closing connections and timeouts to proxies and TLS problems, with steps to find the cause.
- Nginx "upstream timed out (110)": how to fix it: Fix Nginx upstream timed out (110: Connection timed out) while reading response header: find the slow request, tune proxy timeouts and fix the backend.
- HikariCP "Connection is not available": how to fix it: Fix HikariCP Connection is not available, request timed out: use leak detection, size the pool sensibly, avoid long transactions and read pool metrics.
- ERR_CONNECTION_TIMED_OUT: why a site will not load: Why browsers show ERR_CONNECTION_TIMED_OUT, how to tell a client problem from a server one, and the firewall, DNS and server checks that find the cause.
- Cloudflare error 524: a timeout occurred: Fix Cloudflare error 524: the origin accepted the connection but sent no HTTP response within 100 seconds. Find the slow request and move long work off it.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.