"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.
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.
for i in 1 2 3; do npm install && break; sleep 5; donePoint at a reliable resolver
Give the container or runner a dependable DNS server so lookups do not time out.
container:
image: node:20
options: --dns 1.1.1.1 --dns 8.8.8.8How 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.