Skip to content
Latchkey

curl --retry-all-errors: Retry Beyond Transient

Plain --retry ignores connection and DNS errors; --retry-all-errors does not.

When you want curl to keep trying through any failure, including connect and resolve errors, --retry-all-errors widens the net.

What it does

--retry-all-errors changes --retry so it retries on all errors curl reports, not just the default transient set of timeouts and selected 5xx codes. Combined with --retry it covers connection failures, DNS issues, and other non-transient errors. It must be used together with --retry, and it requires curl 7.71.0 or newer.

Common usage

Terminal
curl --retry 5 --retry-all-errors https://api.example.com/x
curl -fsS --retry 6 --retry-all-errors --retry-connrefused \
     --retry-max-time 90 -o out.bin https://artifacts.example.com/out.bin

Flags

FlagWhat it does
--retry-all-errorsRetry on any error (needs --retry, curl 7.71+)
--retry <n>Required: number of retry attempts
--retry-connrefusedSpecifically retry on connection refused (7.52+)
--retry-max-time <s>Bound total retry time

In CI

Use --retry-all-errors when an endpoint or DNS is briefly unavailable at job start, for example a service that is still booting. Bound it with --retry-max-time so a permanently broken host does not stall the job for minutes. Keep -f on so a final error still fails the step.

Common errors in CI

curl: option --retry-all-errors: is unknown means your runner curl is older than 7.71; upgrade or write a shell retry loop. If it seems to do nothing, confirm you also passed --retry with a count greater than zero.

Related guides

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