Lingua-e
← Errors
JavaScript

ETIMEDOUT: What It Means and How to Fix It

Error reference

ETIMEDOUT

Language

JavaScript

Severity

High

When it happens

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.

Potential fixes

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.

Deep dive

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.

Potential fixes

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.

Examples

JavaScript

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'

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");
  }
}

Practice in English

How would you explain an ETIMEDOUT to a fellow dev? Choose the right phrase:

"I hit an error...

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