ETIMEDOUT, Connection Timed Out
The connection attempt timed out before a response was received.
Root Cause
The remote host is unreachable, a firewall is silently dropping packets, or the server is too slow to respond within the timeout period.
How to Fix
Check network connectivity to the remote host. Increase the timeout if the server is legitimately slow. Implement retry logic with exponential backoff.
Quick Summary
ETIMEDOUT means the connection attempt timed out. Check network connectivity, verify the host is reachable, and implement retry logic with exponential backoff for transient failures.
Key Takeaways
- The remote host did not respond within the timeout period
- Different from ECONNREFUSED, ETIMEDOUT means no response, not an active refusal
- Implement retry logic with exponential backoff for transient timeouts
- Check firewall rules, silent packet drops cause ETIMEDOUT
When to use it
- Database connection timeout
- External API not responding
- Network partition in a distributed system
Common Mistakes
- Not implementing retry logic, a single timeout should not fail the entire operation
- Setting timeouts too low for slow operations like large database queries
ETIMEDOUT ETIMEDOUT, Connection Timed Out, Frequently Asked
What is the difference between ETIMEDOUT and ECONNREFUSED?
ECONNREFUSED: the server actively refused the connection (nothing listening). ETIMEDOUT: the server did not respond at all (unreachable, firewall, or too slow).
Still having issues?
Check your network logs or use our developer tools to inspect headers, decode tokens, or validate your requests.