HTTP: ConnectionResetError: Connection reset by peer
Last verified
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
- Retry once after a delay; isolated resets on reused connections are normal.
- If resets are frequent, lower your request rate and concurrency; persistent resets after many requests usually mean you are being throttled.
- Check robots.txt and the site's terms; if automated access is not welcome, stop.
- Configure a retry adapter for idempotent requests with backoff (urllib3 Retry).
- 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
- Max retries exceeded with urlrequests.exceptions.ConnectionError: HTTPSConnectionPool(host='example.com',…
- SSL: CERTIFICATE_VERIFY_FAILEDssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate…
- 429 Too Many Requestsrequests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url:…
Definitions
- CAPTCHACAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) is a challenge-response m
- Cloudflare Bot ManagementCloudflare Bot Management is the set of Cloudflare features (Bot Fight Mode, Super Bot Fight Mode and the Ente
- DataDomeDataDome is a commercial bot-protection service that scores every request to a website, app or API in real tim
- HUMAN Security (PerimeterX)PerimeterX, now HUMAN Security's Bot Defender after a 2022 merger, is a bot-protection service that scores eve
- User AgentA user agent is a string that browsers send with every HTTP request identifying the browser type, version, and
- AI Web ScraperAn AI web scraper is an AI-powered data extraction tool that understands page structure, identifies relevant d
- Data ScrapingData scraping is the broad practice of programmatically extracting data from any digital source — websites, ap
- Web CrawlerA web crawler (also called a spider or bot) is a program that systematically browses the internet by following
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.