Skip to content
Latchkey

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 ECONNRESET

Common 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 30

Reduce stress on the connection

  1. Lower download concurrency to ease pressure on the upstream.
  2. Use a mirror/cache to shorten the path.
  3. 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

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