ECONNRESET node network_error ai_generated partial

Error: read ECONNRESET

ID: node/econnreset

Also available as: JSON · Markdown
80%Fix Rate
85%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
20 active

Root Cause

TCP connection forcibly closed by remote. Server crashed, timeout, or load balancer dropped connection.

generic

Official Documentation

https://nodejs.org/api/errors.html#common-system-errors

Workarounds

  1. 90% success Add retry logic with exponential backoff for transient network issues
    const axios = require('axios');
    const axiosRetry = require('axios-retry');
    
    axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });
    await axios.get('https://api.example.com/data');

    Sources: https://nodejs.org/api/errors.html#common-system-errors

  2. 88% success Check server-side logs — the server is closing the connection
    Check server-side logs — the server is closing the connection

    Sources: https://nodejs.org/api/errors.html#common-system-errors

  3. 82% success If behind a proxy/LB, check its timeout settings
    # Check nginx proxy timeout settings:
    # In nginx.conf: proxy_read_timeout 120s; proxy_connect_timeout 60s;
    # For AWS ALB: check idle timeout in target group settings (default 60s)
    # For HAProxy: timeout server 120s

    Sources: https://nodejs.org/api/http.html#httpagent

Dead Ends

Common approaches that don't work:

  1. Increase socket timeout to very large value 70% fail

    If server crashed, waiting longer won't help

  2. Disable keep-alive 65% fail

    Keep-alive isn't the cause — the server actively reset the connection

Error Chain

Frequently confused with: