Skip to content
Latchkey

CI "Could not resolve host" (DNS Failure)

A name lookup failed, so the client never reached the server. In CI this is usually a transient DNS hiccup on the runner network rather than a wrong hostname.

What this error means

A clone, install, or curl fails with Could not resolve host: <host>. Re-running the same job, unchanged, usually succeeds, the signature of a transient resolution blip.

shell
fatal: unable to access 'https://github.com/org/repo.git/': Could not resolve host: github.com

Common causes

Transient DNS resolution failure

A momentary DNS timeout or resolver hiccup on the runner network breaks the lookup; the host itself is fine.

A genuinely wrong or private hostname

A typo or an internal-only host that the runner cannot resolve fails every time, not just once.

How to fix it

Retry the network step

Wrap flaky network calls in a bounded retry so a single DNS blip does not fail the build.

shell
for i in 1 2 3; do
  curl -fsSL https://example.com/install.sh && break
  sleep $((i*5))
done

Confirm the host and resolver

  1. Verify the hostname is correct and publicly resolvable.
  2. Test resolution directly (getent hosts <host> / nslookup <host>).
  3. For private hosts, ensure the runner has the right DNS/VPC config.

How to prevent it

  • Add retries around network-dependent steps.
  • Pin dependencies/mirrors to reduce lookups.
  • On managed runners, transient DNS blips are detected and the job is automatically retried, so a one-off failure does not break the build.

Frequently asked questions

What causes "Could not resolve host (DNS)"?
A momentary DNS timeout or resolver hiccup on the runner network breaks the lookup; the host itself is fine.
How do I fix Could not resolve host (DNS)?
Wrap flaky network calls in a bounded retry so a single DNS blip does not fail the build.
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