ETIMEDOUT is a Node.js network error code indicating that a network operation (connection attempt or data transfer) did not complete within the allowed time. It is the Node.js equivalent of Python's TimeoutError and is distinct from ECONNRESET.
Why it happens
- •The remote host is unreachable and SYN packets are dropped (not rejected).
- •A connection timeout fires before the TCP handshake completes.
- •A read timeout fires because the server accepted the connection but never responded.
- •An overloaded server queue never processes the request.
Examples
Code that triggers the error
const axios = require("axios");
await axios.get("https://10.255.255.1/api", { timeout: 3000 });Error output
Error: timeout of 3000ms exceeded
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT'How to fix it
Set explicit timeouts on all outbound network calls. Distinguish between connection timeouts (server unreachable) and read timeouts (server slow). Implement circuit breakers for dependencies that frequently time out.
Fixed code
const axios = require("axios");
try {
const res = await axios.get("https://api.example.com/data", {
timeout: 5000,
});
} catch (err) {
if (err.code === "ETIMEDOUT") {
console.error("Request timed out");
}
}Related errors
Ready to practice your English at work?
Lingua-e has interactive exercises built around real developer conversations: standups, code reviews, retrospectives, and more. Practice until it comes naturally.
Try Lingua-e for free