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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →