Skip to content
Latchkey

curl Exit Code 7 in CI: Failed to Connect to Host

curl exit code 7 means "failed to connect to host" - DNS worked but the TCP connection could not be established.

A step exiting 7 from curl resolved the host but could not open a connection: the port was closed, refused, or unreachable.

What it means

Exit 7 is curl's CURLE_COULDNT_CONNECT. The address resolved but the connection attempt failed - connection refused, no route, or a firewall drop.

Common causes

  • The target service is not yet up (race in CI startup).
  • A firewall or security group blocks the port.
  • A wrong port or scheme.

How to fix it

Confirm the service is listening on the expected port and reachable from the runner. Add a readiness wait before the request. A service still starting up often succeeds on retry.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →