Skip to content
Latchkey

"EAI_AGAIN" DNS temporary failure in CI

getaddrinfo returned EAI_AGAIN, a temporary name resolution failure. Unlike NXDOMAIN, this means the resolver did not answer in time (unreachable, overloaded, or misconfigured), so retrying can succeed once DNS responds.

What this error means

Node or other clients fail with "getaddrinfo EAI_AGAIN <host>". The C library equivalent is "Temporary failure in name resolution". It is often intermittent.

Terminal
Error: getaddrinfo EAI_AGAIN registry.npmjs.org
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)
  code: 'EAI_AGAIN'

Common causes

The DNS server is unreachable or slow

The configured resolver did not answer within the timeout, so getaddrinfo reports a temporary failure that may clear on retry.

Resolver misconfiguration in a container

A container that just started, or one with a resolver on a flaky path, intermittently fails to reach DNS.

How to fix it

Retry the operation

Because EAI_AGAIN is explicitly temporary, wrapping the network call in a short retry usually succeeds once DNS responds.

Terminal
for i in 1 2 3; do npm install && break; sleep 5; done

Point at a reliable resolver

Give the container or runner a dependable DNS server so lookups do not time out.

.github/workflows/ci.yml
container:
  image: node:20
  options: --dns 1.1.1.1 --dns 8.8.8.8

How to prevent it

  • Configure a fast, reliable resolver for job containers.
  • Add retries around network calls so transient DNS failures self-heal.
  • Warm DNS early in the job to surface resolver problems before the critical steps.

Frequently asked questions

What causes ""EAI_AGAIN""?
The configured resolver did not answer within the timeout, so getaddrinfo reports a temporary failure that may clear on retry.
How do I fix "EAI_AGAIN"?
Because EAI_AGAIN is explicitly temporary, wrapping the network call in a short retry usually succeeds once DNS responds.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card