Skip to content
Latchkey

curl: (6) Could not resolve host in CI

curl exit code 6 means it could not resolve the hostname. In CI this is usually a transient DNS hiccup during an install script or asset download, not a wrong URL.

What this error means

A curl step fails with curl: (6) Could not resolve host: <host>. Re-running the unchanged job usually succeeds, the mark of a transient resolution blip.

shell
curl: (6) Could not resolve host: get.example.com

Common causes

Transient DNS resolution failure

A momentary resolver timeout breaks the lookup; the host is reachable a moment later.

A wrong or private hostname

A typo or internal-only host fails consistently, not intermittently.

How to fix it

Use curl built-in retries

curl can retry transient failures itself.

shell
curl --retry 5 --retry-all-errors --retry-delay 3 \
  -fsSL https://get.example.com/install.sh | bash

Verify the host

  1. Confirm the hostname is correct and public.
  2. Test resolution (getent hosts <host>).
  3. For internal hosts, check runner DNS/VPC settings.

How to prevent it

  • Use --retry / --retry-all-errors for curl in CI.
  • Prefer cached or pinned downloads.
  • On managed runners, transient DNS blips are detected and the job is automatically retried, so a one-off curl (6) does not fail the build.

Related guides

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