Self-Healing CI: Handling Network Timeouts and Flaky Connections
A download or connection that times out once will usually succeed on a clean retry - the network blipped, your code did not change.
The problem
A step that fetches dependencies, pulls an image, or calls an external service fails with a connection timeout or reset. Re-running the job resolves it with no code change.
curl: (28) Operation timed out after 30002 milliseconds
# or
ETIMEDOUT request to https://... failed, reason: connect ETIMEDOUTWhy it happens
CI runners depend on external networks for nearly every step. Transient DNS hiccups, congested links, and brief upstream slowdowns cause occasional timeouts that have nothing to do with your build.
A single fixed timeout with no retry turns a momentary blip into a failed pipeline.
The manual fix
Typical manual mitigations:
- Re-run the job.
- Add retry-with-backoff around network commands.
- Increase client timeouts and pin/mirror dependencies to reduce external calls.
How this gets automated
Timeouts and connection resets carry a recognizable signature and a safe default response - retry with backoff. A self-healing pipeline detects the transient failure and retries automatically, surfacing the step only if it keeps failing, which is the signal that the problem is real rather than a blip.