error hub
ECONNREFUSED errors
Public KFA evidence for refused network connections, kept separate from DNS and timeout failures.
Common Problems
- [Node.js 17+] 'Error: connect ECONNREFUSED ::1:<port>' connecting to localhost — DNS order changed to verbatim so localhost resolves to IPv6 while the server listens on 127.0.0.1 only
Cause (Documented platform behavior): In v17.0.0 the dns.lookup `verbatim` default became true (order 'verbatim'), so addresses are returned in resolver order and ::1 may come first; if the server does not listen on IPv6 the connect is refused. Fix status: documented_behavior Workaround (not a fix): dns.setDefaultResul
- [Redis client in Docker Compose] 'Error: connect ECONNREFUSED 127.0.0.1:6379' — app container connects to its own localhost instead of the redis service
Cause (Documented platform behavior): Inside a container, 127.0.0.1 is the container itself; other compose services are reachable by service name on the compose network. node-redis defaults socket.host to 'localhost' when host isn't set via url or socket.host. Fix status: documented_behavior Misleading approaches: - Pa
- [Cursor agent] 'Connection stalled' / 'The connection stalled N times. Please check your network connection' — HTTP/2 and socket errors classified as retryable transport failures
Cause (Documented platform behavior): Errors whose message/code contain NGHTTP2, ECONNRESET, ECONNREFUSED, ETIMEDOUT, EPIPE, "socket hang up", "Premature close", ERR_STREAM, "protocol error", "http/2 stream", ERR_HTTP2_SESSION_ERROR, "Session closed with error code", "connection aborted", or DNS failures (ENOTFOUND, EA
- How should an ECONNREFUSED error distinguish an absent listener from a container port mismatch?
## Question How should an ECONNREFUSED error distinguish an absent listener from a container port mismatch? ## Why this matters Recurring public developer task for HTTP and integration errors. ## Environment / product HTTP and integration errors ## What needs to be determined Current researched guidance, applicability,
Solutions with evidence
- Proposed fix: [Node.js 17+] 'Error: connect ECONNREFUSED ::1:<port>' connecting to localhost — DNS order changed to verbatim so localhost resolves to IPv6 while the server listens on 127.0.0.1 only
Recommended action: Connect to 127.0.0.1 explicitly, or make the server listen on both stacks; or set `--dns-result-order=ipv4first` / `dns.setDefaultResultOrder('ipv4first')`. On Node >=20 (and 18.18+), net autoSelectFamily tries IPv6 and IPv4 addresses in sequence, which helps when both are returned. Option: Use 127.
- Proposed fix: [Redis client in Docker Compose] 'Error: connect ECONNREFUSED 127.0.0.1:6379' — app container connects to its own localhost instead of the redis service
Recommended action: Point the client at the service name: createClient({ url: 'redis://redis:6379' }) or socket: { host: 'redis' }; ensure both services share the compose network. Option: Use service name via url or socket.host [evidence: documented_workaround] Applies when: Compose/K8s Steps: 1. createClient({ url: pr
- Researched guidance: How should an ECONNREFUSED error distinguish an absent listener from a container port mismatch?
## Summary ECONNREFUSED is a transport-level observation that a TCP stream connection to the resolved remote address and port was actively refused; it does not by itself identify whether the listener is absent because the process is down, the wrong port or address was selected, or a container/service port mapping targe