ECONNREFUSED node network_error ai_generated true

Error: connect ECONNREFUSED 127.0.0.1:3000

ID: node/econnrefused

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
20 active

Root Cause

Target server is not running or not accepting connections on the expected port.

generic

Official Documentation

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

Workarounds

  1. 95% success Verify the target service is running: check process, port, and network
    lsof -i :3000 || netstat -tlnp | grep 3000

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

  2. 88% success In Docker/K8s: use service name instead of localhost, check network connectivity
    use service name instead of localhost, check network connectivity

    Sources: https://docs.docker.com/network/

Dead Ends

Common approaches that don't work:

  1. Increase connection timeout 80% fail

    Server isn't running — waiting longer won't help

  2. Change to 0.0.0.0 binding 65% fail

    Confuses listen address with connect address

Error Chain

Frequently confused with: