---
title: "ECONNRESET and ERR_CONNECTION_RESET: connection reset, fixes"
description: "ECONNRESET, [Errno 104], WinError 10054 and ERR_CONNECTION_RESET mean the other side cut the line mid-request. Why scrapers get reset, and how to fix it."
url: "https://scrapenews.com/errors/econnreset-connection-reset"
updated: "2026-11-26T00:00:00Z"
---

# ECONNRESET and ERR_CONNECTION_RESET: connection reset, fixes

HTTP status codes · ECONNRESET

Published 26 Nov 2026

What you see

- `Error: read ECONNRESET`
- `Error: socket hang up`
- `code: 'ECONNRESET'`
- `AxiosError: read ECONNRESET`

**More error strings (13)**

- `SocketError: other side closed`
- `UND_ERR_SOCKET`
- `requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))`
- `urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))`
- `ConnectionResetError: [Errno 104] Connection reset by peer`
- `ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host`
- `WSAECONNRESET`
- `net::ERR_CONNECTION_RESET`
- `Error: net::ERR_CONNECTION_RESET at`
- `page.goto: net::ERR_CONNECTION_RESET at`
- `page.goto: NS_ERROR_NET_RESET`
- `Recv failure: Connection reset by peer`
- `CURL ERROR: Recv failure: Connection reset by peer`

## What it means

The other side cut the line in the middle of a request. Not politely: it sent a TCP reset (RST, a “this connection is dead” signal) and dropped the line. You get no status code, no error page, nothing to read. The “other side” is whatever you were connected to: the site, a firewall in front of it, or your proxy.

## Why it happens

A reset is like someone slamming the phone down mid-sentence. You know the call ended. You don’t know why. These are the usual causes, most common first:

1. **A stale keep-alive socket.** Keep-alive means reusing one open connection for many requests. If the server closes it at the same moment your client reuses it, Node’s docs say the request “may encounter an ECONNRESET error”. Since Node v19, the global agent keeps connections alive by default.
2. **The site doesn’t like your TLS handshake.** TLS is the encryption setup at the start of every `https://` connection, and each client does it a little differently. In claude-code issue #37300 (Mar 2026), a user reported that Cloudflare rejected Node’s standard handshake with `ECONNRESET`, while Chrome on the same network connected fine.
3. **The site doesn’t like your browser.** In Puppeteer issue #1477, `page.goto` failed with `net::ERR_CONNECTION_RESET`. One commenter said the server was rejecting headless Chrome. **Setting a normal user agent fixed it**, and another said it made the on-and-off resets stop.
4. **You opened too many connections too fast.** Servers can cut you off before you ever see a 429. HAProxy’s docs show a rule that drops new connections from one IP above a chosen rate: `reject` “closes the connection without sending any response”.
5. **Your proxy dropped the line.** Through a proxy, your connection goes to the proxy, not the site. If the proxy or its exit IP goes away mid-request, the proxy is the one that hangs up.
6. **The server crashed or restarted.** Node’s docs blame “a timeout or reboot” on the remote side, and Microsoft’s list also names a stopped app or a disabled network interface.

Not every block ends in a reset. HAProxy’s `silent-drop` makes the connection “suddenly disappear” and tries not to send a FIN or RST at all. Your client still thinks it is connected, so you see a [timeout](https://scrapenews.com/errors/scraping-timeout.md), not a reset.

Resets turn up where you’d expect a block page. A block page needs an HTTP answer, like a [403](https://scrapenews.com/errors/403-forbidden.md) or a [429](https://scrapenews.com/errors/429-too-many-requests.md). A reset means the cut happened lower down, before any HTTP answer was sent.

The keep-alive race. A Node.js server closes an idle connection after 5 seconds by default (`server.keepAliveTimeout`). Servers may announce it as `Keep-Alive: timeout=5`. Send your next request just as that clock runs out, and your request lands on a closing socket.

The TLS check reads your first message, the ClientHello: TLS versions, cipher suites, extensions and their order. These differ per client, so a site can tell Python requests from Chrome even with identical headers. curl_cffi also copies HTTP/2 settings.

Cloudflare documents the check. JA3 and JA4 fingerprints “identify TLS clients based on how they initiate connections”, and site owners can act on them in WAF custom rules, Transform Rules and Workers.

Proxy drops have a documented cause as well. Apify’s residential proxy docs say a session “can be destroyed at any time” when the home device behind it is turned off or disconnected.

## Fix it

1. **Check when it fails.** First request every time? Likely a block (causes 2 to 4). Random ones, after a few idle seconds? Likely keep-alive (cause 1). Only under load? Likely rate limits (cause 4).
2. **Retry once on a fresh connection.** For a GET, that is safe, and Node’s docs show the pattern: retry when `req.reusedSocket` is true and the code is `ECONNRESET`. In Python, use urllib3’s `Retry` with `read=` set (code in the Dev details section).
3. **Test the URL by itself.** Run `curl -v <url>` and open it in a normal browser on the same network. Browser works, your script resets? The site is judging your client, not your IP.
4. **Look like a browser at the TLS layer.** curl_cffi copies a real browser’s TLS and HTTP/2 fingerprints: `curl_cffi.get(url, impersonate="chrome")`. Its README says: if a site blocks you “for no obvious reason”, give it a try.
5. **In a headless browser, send a real user agent.** That was the fix in Puppeteer issue #1477: `page.setUserAgent('Mozilla/5.0 …')`.
6. **Slow down.** Fewer requests in parallel, a pause in between. If resets start only under load, this is your fix.
7. **Through a proxy, test without it.** Same URL, direct, with curl. Works direct but not proxied? Start a new proxy session or IP, then retry.

Don’t retry a POST (a form or a checkout) blindly. urllib3 warns that read errors happen after the request has been sent, “so the request may have side-effects”.

Why one retry often works: with keep-alive, the first failure is a race and not a ban. Your client picked a connection the server had already started to close. A second try gets a fresh one.

Why it doesn’t fix a block: a site that resets you for your fingerprint resets you every time. When a retry fails the same way, stop and change the client (steps 4 and 5).

Turning keep-alive off (`keepAlive: false`) is a test, not a fix: every request then opens a new TCP connection. If the resets stop, you found cause 1. Turn it back on and add the reused-socket retry or `agentKeepAliveTimeoutBuffer`, so your side hangs up first.

On step 6, our advice: HAProxy’s example rule counts fresh connections from your IP, so keep-alive helps you stay under limits like it.

Paste this into your AI

```
My scraper fails with a connection reset:
"<paste the full error, including everything after 'Caused by' or 'cause'>"
Tell me in plain words who cut the connection: the website, my proxy, or a stale reused connection.
Then list the likely causes in order, most likely first: keep-alive reuse,
TLS fingerprint blocking, rate limiting, a dropped proxy exit.
For each cause, give one quick test and one fix.
Show a curl -v command that tests the same URL directly and through my proxy.
My setup: <language + library or browser tool, version>,
<direct, or proxy: provider + residential/datacenter, rotating/sticky>,
requests in parallel: <number>, keep-alive: <on/off/default>,
does the URL open in a normal browser on the same network? <yes/no>,
does it fail on the first request or after a while? <first / after N requests / random>.
```

## Dev details

### What each tool prints

| tool | error | where it comes from |
| --- | --- | --- |
| Node.js `http` / axios | `Error: read ECONNRESET` (`code: 'ECONNRESET'`, `syscall: 'read'`, `errno: -104`) | Node system error |
| Node.js `http` | `Error: socket hang up` (code `ECONNRESET`) | closed before any response |
| Node.js `fetch` (undici) | `SocketError: other side closed` (code `UND_ERR_SOCKET`) | undici |
| Python requests | `ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))` | urllib3 `ProtocolError` |
| Python on Windows | `ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host` | Winsock `WSAECONNRESET` |
| Chrome, Puppeteer, Playwright | `net::ERR_CONNECTION_RESET` | Chromium `CONNECTION_RESET` (-101) |
| Playwright with Firefox | `page.goto: NS_ERROR_NET_RESET` | Firefox |
| curl, PHP cURL | `Recv failure: Connection reset by peer` | curl |

urllib3 wraps any `OSError` during a request as `ProtocolError("Connection aborted.", e)`. So the useful part is the one inside: `ConnectionResetError` is a reset, while `RemoteDisconnected('Remote end closed connection without response')` is a plain close.

Python’s `ConnectionResetError` is a subclass of `ConnectionError` and maps to errno `ECONNRESET`. On Windows this same code is Winsock error 10054.

### Chromium’s three ways to lose a connection

```cpp
// A connection was closed (corresponding to a TCP FIN).
NET_ERROR(CONNECTION_CLOSED, -100)

// A connection was reset (corresponding to a TCP RST).
NET_ERROR(CONNECTION_RESET, -101)

// The server closed the connection without sending any data.
NET_ERROR(EMPTY_RESPONSE, -324)
```

`ERR_CONNECTION_CLOSED` is a polite hang-up. `ERR_CONNECTION_RESET` is the slammed phone. `ERR_EMPTY_RESPONSE` means the server closed before saying anything.

### Node.js: retry a reset on a reused socket

From the official Node.js HTTP docs:

```js
import http from 'node:http';

const agent = new http.Agent({ keepAlive: true });

function retriableRequest() {
  const req = http
    .get('http://localhost:3000', { agent }, (res) => {
      // ...
    })
    .on('error', (err) => {
      if (req.reusedSocket && err.code === 'ECONNRESET') {
        retriableRequest();
      }
    });
}
```

Since Node v24.7.0 and v22.20.0, `http.Agent` takes `agentKeepAliveTimeoutBuffer` (default 1000 ms). It subtracts that from the server’s `Keep-Alive: timeout=…` hint, so your agent closes the socket a bit before the server does.

### Python requests: retry resets, not only connect errors

`HTTPAdapter(max_retries=3)` doesn’t cover this. The requests docs say an integer applies only to failed DNS lookups, socket connections and connection timeouts, “never to requests where data has made it to the server”. A reset after the request went out is a read error. Pass a urllib3 `Retry`:

```python
import requests
from requests.adapters import HTTPAdapter
from urllib3.util import Retry

retry = Retry(total=3, connect=3, read=2, backoff_factor=0.5)
s = requests.Session()
s.mount("https://", HTTPAdapter(max_retries=retry))
r = s.get("https://example.com/page", timeout=(3.05, 27))
```

`Retry` retries only `DELETE`, `GET`, `HEAD`, `OPTIONS`, `PUT` and `TRACE` by default (`allowed_methods`), so POSTs are left alone. `backoff_factor` sets the wait between tries: at 0.1, urllib3 sleeps 0.0 s, 0.2 s, 0.4 s, 0.8 s and never past `backoff_max` (120 s).

### TLS fingerprint: swap the client

```python
import curl_cffi

r = curl_cffi.get("https://example.com/page", impersonate="chrome")
```

`impersonate="chrome"` picks the latest Chrome curl_cffi knows and needs no version number.

### Rate limits that cut you off

A server-level rule from HAProxy’s docs:

```text
tcp-request connection reject if { src_conn_rate gt 10 }
```

`reject` “closes the connection without sending any response”. HAProxy notes that connection-level rejects go unlogged, because they target floods like DDoS attacks.

### Edge cases

- **The reset can be yours.** Bright Data logs a client that hangs up on its proxy first as `client_10140` (“Client disconnect”), usually from a client timeout, a cancelled request or a local network problem.
- **Only one site.** In Puppeteer issue #4476, the reset came on one specific site’s page. Run a second site through the same setup before blaming your network.
- **Works locally, resets in CI.** In Playwright issue #16749, tests passed on a laptop but failed in Azure DevOps Pipelines with `page.goto: net::ERR_CONNECTION_RESET` (and `NS_ERROR_NET_RESET` in Firefox). A Playwright team member said the error “indicates network issues” and asked whether the app was reachable from Azure at all.

Node’s `fetch` hides the reason one level down: undici rejects with `new TypeError('fetch failed', { cause: response.error })`, so the message alone tells you nothing. Log `err.cause` and its `code`: `UND_ERR_SOCKET` with “other side closed”, or `ECONNRESET`.

When the reset happens matters too. Before any response, Node’s `http` gives you `socket hang up` on the request. If the response already started, the response object emits an error with the message `aborted` and code `ECONNRESET`, and the original socket error sits in its `cause`. Partial data then points to a cut-off download, not an empty page.

In Python, the reason sits inside the `ProtocolError`. `ConnectionResetError` is a reset, `RemoteDisconnected` is a plain close. Log the inner one, since it shows which of the two you are fighting.

## Open questions

No big anti-bot vendor documents resetting connections because of a TLS fingerprint. The link rests on user reports such as claude-code issue #37300. Apify’s docs warn that residential connections can drop, but Bright Data’s error list has no code for a reset, so a proxy-side reset is hard to tell apart from a site-side one.

Why it matters: a reset tells you nothing, so you have to guess the reason. If a vendor said “we reset on a bad fingerprint”, you’d swap the client at once instead of retrying.

The closest Cloudflare gets is in its HTTP DDoS protection. Its “Force Connection Close” action shuts ongoing connections and “forces the client to reconnect”. That is about floods and not fingerprints, and Cloudflare calls it an internal action you can’t use in overrides.

Apify’s advice for unstable residential sessions: use a datacenter proxy for larger requests, or plan for interruptions and build for them. Our advice: make retries part of your scraper from day one, whichever proxy you use.

## Questions

### What does 'socket hang up' mean in Node.js?

The connection closed before any response came back. Node's HTTP docs list it as the error you get on a premature close: message 'Error: socket hang up', code 'ECONNRESET'. Treat it like any other reset.

### Why do I get ECONNRESET only now and then, not on every request?

Often a reused keep-alive connection. Node's docs say that if the server closes a kept-alive connection at the same moment your agent reuses it, the request can fail with ECONNRESET. Node's global agent keeps connections alive by default since v19. Check request.reusedSocket and retry once.

### Why does the site open in my browser but reset my script?

The site may judge your client by its TLS handshake, before it reads a single header. In claude-code issue #37300, a user reported that Cloudflare rejected Node's default TLS handshake while Chrome connected fine. Clients like curl_cffi copy a real browser's handshake.

## scrapenews difficulty

Not scored. We have 2 of 8 factors; a score needs 3.

| Factor | What we found | Source |
| --- | --- | --- |
| Smallest client that gets through | a plain HTTP client | [nodejs.org](https://nodejs.org/api/http.html) |
| Checks stacked | TLS fingerprint | [github.com](https://github.com/anthropics/claude-code/issues/37300) |

Our analysis of 2 sourced facts; measured runs replace them as they come. [How we rate difficulty](https://scrapenews.com/rating.md)

## Related

- [Why am I blocked? How to avoid getting blocked while scraping](https://scrapenews.com/guides/how-to-avoid-getting-blocked-scraping.md)  (Guide)
- [Rotating proxies](https://scrapenews.com/guides/rotating-proxies.md)  (Guide)
- [Python web scraping](https://scrapenews.com/guides/python-requests-beautifulsoup.md)  (Guide)
- [HTTP clients and TLS](https://scrapenews.com/compare/http-clients.md)  (Compare)
- [ERR_HTTP2_PROTOCOL_ERROR when scraping](https://scrapenews.com/errors/err-http2-protocol-error.md)  (Error)
- [Kasada 429 with x-kpsdk headers](https://scrapenews.com/errors/kasada.md)  (Error)

## Tools that get past it

| Tool | Price |
| --- | --- |
| [Axios](https://scrapenews.com/compare/axios.md): Promise-based HTTP client for the browser and Node.js, with request and response interceptors and TypeScript types. | Free |
| [curl_cffi](https://scrapenews.com/compare/curl-cffi.md): Python HTTP client on curl-impersonate that can copy a browser's TLS, JA3 and HTTP/2 fingerprints. | Free |
| [Playwright](https://scrapenews.com/compare/playwright.md): Microsoft's framework to drive Chromium, Firefox and WebKit from code with one API. Made for testing; also used to scrape. | Free |
| [Puppeteer](https://scrapenews.com/compare/puppeteer.md): JavaScript library to control Chrome and Firefox from code. | Free |
| [Requests](https://scrapenews.com/compare/requests.md): The classic simple HTTP library for Python. | Free |

## Sources

1. [Node.js docs: Common system errors (ECONNRESET)](https://nodejs.org/api/errors.html) nodejs.org
2. [Node.js docs: HTTP (socket hang up, request.reusedSocket, http.globalAgent, agentKeepAliveTimeoutBuffer)](https://nodejs.org/api/http.html) nodejs.org
3. [undici source: errors.js (SocketError, UND_ERR_SOCKET)](https://github.com/nodejs/undici/blob/main/lib/core/errors.js) github.com
4. [undici source: client-h1.js ('other side closed')](https://github.com/nodejs/undici/blob/main/lib/dispatcher/client-h1.js) github.com
5. [undici source: fetch/index.js (TypeError 'fetch failed' with cause)](https://github.com/nodejs/undici/blob/main/lib/web/fetch/index.js) github.com
6. [MDN: Keep-Alive header (timeout, max)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Keep-Alive) developer.mozilla.org
7. [Stack Overflow: Python requests being fingerprinted? (TLS ClientHello)](https://stackoverflow.com/questions/60407057) stackoverflow.com
8. [nodejs/node issue #44936: Error: read ECONNRESET](https://github.com/nodejs/node/issues/44936) github.com
9. [Python docs: Built-in exceptions (ConnectionResetError)](https://docs.python.org/3/library/exceptions.html) docs.python.org
10. [Microsoft Learn: Windows Sockets error codes (WSAECONNRESET 10054)](https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2) learn.microsoft.com
11. [urllib3 source: connectionpool.py (ProtocolError 'Connection aborted.')](https://github.com/urllib3/urllib3/blob/main/src/urllib3/connectionpool.py) github.com
12. [urllib3 docs: Retry (read errors, allowed_methods, backoff_factor)](https://urllib3.readthedocs.io/en/stable/reference/urllib3.util.html) urllib3.readthedocs.io
13. [Requests docs: HTTPAdapter max_retries](https://requests.readthedocs.io/en/latest/api/) requests.readthedocs.io
14. [oppia/oppia issue #19775: ConnectionError: ('Connection aborted.', ConnectionResetError(104, ...))](https://github.com/oppia/oppia/issues/19775) github.com
15. [Azure/azure-cli issue #28139: ConnectionResetError: \[WinError 10054\]](https://github.com/Azure/azure-cli/issues/28139) github.com
16. [psf/requests issue #5981: ('Connection aborted.', RemoteDisconnected(...))](https://github.com/psf/requests/issues/5981) github.com
17. [Chromium source: net_error_list.h (CONNECTION_RESET -101, CONNECTION_CLOSED -100, EMPTY_RESPONSE -324)](https://chromium.googlesource.com/chromium/src/+/HEAD/net/base/net_error_list.h) chromium.googlesource.com
18. [puppeteer/puppeteer issue #1477: page.goto() generates Error: net::ERR_CONNECTION_RESET](https://github.com/puppeteer/puppeteer/issues/1477) github.com
19. [puppeteer/puppeteer issue #4476: net::ERR_CONNECTION_RESET error](https://github.com/puppeteer/puppeteer/issues/4476) github.com
20. [anthropics/claude-code issue #37300: Cloudflare TLS fingerprint rejection (ECONNRESET/ETIMEDOUT)](https://github.com/anthropics/claude-code/issues/37300) github.com
21. [curl_cffi README: impersonate browser TLS/JA3 and HTTP/2 fingerprints](https://github.com/lexiforest/curl_cffi) github.com
22. [curl_cffi docs: Quick start (impersonate="chrome")](https://curl-cffi.readthedocs.io/en/latest/quick_start.html) curl-cffi.readthedocs.io
23. [HAProxy 3.2 docs: reject, silent-drop, src_conn_rate](https://docs.haproxy.org/3.2/configuration.html) docs.haproxy.org
24. [Stack Overflow: CURL ERROR: Recv failure: Connection reset by peer](https://stackoverflow.com/questions/10285700) stackoverflow.com
25. [Bright Data docs: Proxy errors troubleshooting (client_10140)](https://docs.brightdata.com/proxy-networks/errorCatalog) docs.brightdata.com
26. [Apify docs: Residential proxy (sessions, connection interruptions)](https://docs.apify.com/proxy/residential-proxy) docs.apify.com
27. [Cloudflare docs: JA3/JA4 fingerprint](https://developers.cloudflare.com/bots/additional-configurations/ja3-ja4-fingerprint/) developers.cloudflare.com
28. [Cloudflare docs: HTTP DDoS Attack Protection parameters (Connection Close, Force Connection Close)](https://developers.cloudflare.com/ddos-protection/managed-rulesets/http/override-parameters/) developers.cloudflare.com
29. [microsoft/playwright issue #16749: page.goto: net::ERR_CONNECTION_RESET in Azure DevOps Pipelines](https://github.com/microsoft/playwright/issues/16749) github.com

## Up

- [Home](https://scrapenews.com/index.md)
- [Errors & CAPTCHAs](https://scrapenews.com/errors.md)
