Skip to content
HTTP errors in web scraping and automation · error message

HTTP: ConnectionResetError: Connection reset by peer

RetryableClient and connection exceptions

Last verified

The exact message
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

What it means

The remote side (or something between you and it) closed the TCP connection abruptly by sending a reset, without an HTTP response. Error 104 is ECONNRESET on Linux; on Windows the same condition is [WinError 10054] An existing connection was forcibly closed by the remote host. Requests wraps it as ConnectionError with the tuple ('Connection aborted.', ...), and the related form RemoteDisconnected('Remote end closed connection without response') means the server closed without sending anything.

Servers and firewalls reset connections they decide not to serve, so a reset can be a silent block of traffic that looks automated. It can also be ordinary: an idle keep-alive connection that the server already closed, a load balancer timeout, or a TLS mismatch.

What is not wrong: DNS and the URL. You reached the host.

What it looks like

from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry

s = requests.Session()
s.mount("https://", HTTPAdapter(max_retries=Retry(total=3, backoff_factor=2,
                                                 status_forcelist=[502, 503, 504])))

Why it happens

  • The server or a firewall drops connections from clients it rate-limits or does not want to serve.
  • A pooled keep-alive connection was closed by the server and reused by the client.
  • A load balancer idle timeout shorter than the time your request takes.
  • A TLS version or cipher mismatch handled by closing the connection.
  • Unstable network or VPN.

How to fix it

  1. Retry once after a delay; isolated resets on reused connections are normal.
  2. If resets are frequent, lower your request rate and concurrency; persistent resets after many requests usually mean you are being throttled.
  3. Check robots.txt and the site's terms; if automated access is not welcome, stop.
  4. Configure a retry adapter for idempotent requests with backoff (urllib3 Retry).
  5. Test from another network to rule out a local firewall or VPN.

How to stop it recurring

Keep concurrency per host low, use sessions with sensible retry policies, set timeouts on every request, and monitor reset rates. A rising reset rate is an early warning that the site considers your traffic too heavy.

Official documentation: requests.readthedocs.io/en/latest/api/#exceptions. See all HTTP error messages.

Related errors

Definitions

Quick answers

What does "ConnectionResetError: Connection reset by peer" mean in HTTP?

The remote side (or something between you and it) closed the TCP connection abruptly by sending a reset, without an HTTP response. Error 104 is ECONNRESET on Linux; on Windows the same condition is [WinError 10054] An existing connection was forcibly closed by the remote host .

How do I fix "ConnectionResetError: Connection reset by peer"?

1. Retry once after a delay; isolated resets on reused connections are normal. 2. If resets are frequent, lower your request rate and concurrency; persistent resets after many requests usually mean you are being throttled. 3. Check robots.txt and the site's terms; if automated access is not welcome, stop. 4. Configure a retry adapter for idempotent requests with backoff (urllib3 Retry). 5. Test from another network to rule out a local firewall or VPN.

Retries and timeouts without writing the loop

Autonoly's HTTP Request node and browser steps have per-node retries, timeouts and continue-on-fail, so a transient 429 or 503 can back off instead of failing the run. It has no proxies or IP rotation: if a site blocks automated traffic, that block applies to Autonoly too.

Also see Error handling in workflows.