"ECONNRESET" mid-download in CI
A connection that was already established got a TCP RST partway through the transfer. Something in the path (the server, a proxy, or a firewall) tore down the socket, so the download aborted before completing.
What this error means
A fetch, npm install, or download fails with "read ECONNRESET", "socket hang up", or "Connection reset by peer" after some bytes have already transferred.
npm error code ECONNRESET
npm error network request to https://registry.npmjs.org/... failed, reason:
read ECONNRESETCommon causes
A proxy or firewall drops long-lived connections
An intermediary with an idle or duration limit sends a reset mid-transfer, especially for large artifacts over a slow link.
The server closed the connection abruptly
A registry or mirror under load, or a keep-alive reuse race, can reset an in-flight connection.
How to fix it
Retry with backoff
Resets mid-download are usually transient; retry the fetch a few times so a clean attempt can complete.
for i in 1 2 3; do curl -fSL "$URL" -o out.tgz && break; sleep 5; doneReduce connection reuse that triggers resets
For clients that reuse sockets aggressively, lowering concurrency or disabling keep-alive reuse can avoid the reset path.
npm config set maxsockets 1
npm config set fetch-retries 5How to prevent it
- Cache large artifacts so a single reset does not force a full refetch.
- Keep transfers under any proxy idle or duration limits, or raise those limits.
- Add retries around downloads so a mid-transfer reset self-heals.