Error: socket hang up / read ECONNRESET
The other side closed the TCP connection abruptly while your client was still using it.
socket hang upConnection reset by peerread ECONNRESETConnection aborted Meaning
The connection was established, then reset. Typical culprits are keep-alive connections reused after the server (or a load balancer) already closed them, servers crashing mid-response, and proxies/firewalls killing long or idle connections.
Common causes
- Reusing a keep-alive socket the server already closed (server keep-alive timeout < client’s)
- Upstream crashed or restarted while handling the request
- Load balancer/NAT idle timeout dropping the connection
- TLS/protocol mismatch (HTTP to an HTTPS port)
- Request body too large → server closes early
⚡ Quick fix
- Retry idempotent requests once on ECONNRESET
- Make server keep-alive timeout longer than the load balancer’s idle timeout
- Check server logs for crashes at the same time
- Verify protocol/port (https on 443)
Detailed fix by platform
Node.js
- Server keep-alive longer than the ALB idle timeout (60s):javascript
const server = app.listen(3000); server.keepAliveTimeout = 65_000; server.headersTimeout = 66_000; // must be greater than keepAliveTimeout
Python
- requests: mount an HTTPAdapter with
Retry(total=3, allowed_methods=None, backoff_factor=0.5)to retry connection resets.
How to diagnose
- When — First request or reused connection?
- Server — Crash/restart logs at that time?
- Timeouts — Keep-alive vs LB idle timeout
- Protocol — Right scheme and port?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in API
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 14 Oct 2026