Skip to content
Latchkey

CI "Temporary failure in name resolution" - Fix EAI_AGAIN

The resolver returned EAI_AGAIN - "temporary failure in name resolution". The word *temporary* is the key: the DNS lookup did not get an authoritative answer, but it is the kind of failure that typically clears on retry.

What this error means

A network call fails with Temporary failure in name resolution or getaddrinfo EAI_AGAIN. It is intermittent - re-running usually succeeds - which distinguishes it from a permanent EAI_NONAME / "host not found".

CI log
ping: github.com: Temporary failure in name resolution
# or
Error: getaddrinfo EAI_AGAIN registry.npmjs.org

Common causes

Upstream DNS timed out or was unreachable

The resolver could not reach the upstream DNS server in time. EAI_AGAIN signals a soft, retryable failure rather than a definitive "no such host".

DNS service not ready at job start

On a freshly booted runner or container, the resolver or network may not be fully up for the first few requests, producing transient EAI_AGAIN early in the job.

How to fix it

Retry with backoff

Because EAI_AGAIN is explicitly temporary, a short retry usually succeeds.

Terminal
for i in 1 2 3; do
  curl -fsSL https://registry.npmjs.org/ && break
  sleep $((i*2))
done

Stabilize resolution if it recurs

  1. Check /etc/resolv.conf has a reachable nameserver.
  2. Add a brief warm-up/wait for the network before the first DNS-dependent step.
  3. Point at a reliable resolver (e.g. 1.1.1.1, 8.8.8.8) if the default is flaky.

How to prevent it

  • Add bounded retries around DNS-dependent steps.
  • Ensure the network/resolver is ready before the first call.
  • Use a dependable resolver and cache/mirror where possible.

Frequently asked questions

What causes ""Temporary failure in name resolution""?
The resolver could not reach the upstream DNS server in time. EAI_AGAIN signals a soft, retryable failure rather than a definitive "no such host".
How do I fix "Temporary failure in name resolution"?
Because EAI_AGAIN is explicitly temporary, a short retry usually succeeds.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.

Related guides

References

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