CI "Connection reset by peer" (ECONNRESET)
The remote end closed the TCP connection mid-transfer (RST). In CI this is a transient network or upstream blip during a download, push, or API call, not a logic error.
What this error means
A network step fails with Connection reset by peer, ECONNRESET, or socket hang up. Re-running the unchanged job usually succeeds.
shell
npm error code ECONNRESET
npm error network request to https://registry.npmjs.org/lodash failed, reason: read ECONNRESETCommon causes
The upstream dropped the connection
A load balancer or server reset an in-flight connection, often under load or during a brief restart.
Transient network instability
Packet loss or a brief path change can surface as a reset on the runner side.
How to fix it
Retry the interrupted transfer
Retries absorb a one-off reset.
shell
npm config set fetch-retries 5
npm ci
# or for git
git config --global http.lowSpeedLimit 1000
git config --global http.lowSpeedTime 30Reduce stress on the connection
- Lower download concurrency to ease pressure on the upstream.
- Use a mirror/cache to shorten the path.
- Authenticate to avoid throttling-induced resets.
How to prevent it
- Configure retries for network operations.
- Cache dependencies to reduce remote hits.
- On managed runners, transient connection resets are detected and the job is automatically retried, so a one-off reset does not fail the build.
Related guides
CI "read tcp ... connection reset by peer"Fix "read tcp ... connection reset by peer" in CI when a Go/Docker client loses an in-flight TCP read. How to…
CI "Connection timed out" (ETIMEDOUT) DownloadingFix "Connection timed out" / ETIMEDOUT in CI while downloading deps, a transient network stall. How to retry…
CI "TLS handshake timeout" Reaching a RegistryFix "net/http: TLS handshake timeout" in CI when a secure connection stalls mid-handshake. How to retry and w…
CI 503/502 from a Package RegistryFix 503 / 502 from a package registry in CI, a transient upstream error. How to retry and why a 5xx self-heal…