| Previous | Next |
| EHOSTUNREACH | EIDRM |
ECONNREFUSED
ECONNREFUSED means the connection attempt received a decisive rejection rather than simply waiting without a response. For a TCP stream connection, a common reason is that no process is listening on the target address and port. The TCP specification defines reset processing for attempts that do not match an existing connection; operating systems expose that outcome through their socket API.
The error does not prove that the destination host is down. It can also result from a service that is stopped, bound only to loopback or another interface, behind an unhealthy load balancer, or intentionally rejected by a firewall or proxy. UDP applications can see a similar result after the network reports that no receiver is associated with the destination.
Useful checks
- Log the resolved IP address and port, not only the original hostname.
- Verify the server listener, its bind address, and whether a reverse proxy is forwarding to the correct upstream port.
- Compare a local refusal with a timeout: an immediate refusal suggests a reachable endpoint that rejected the attempt; a timeout has different causes.
- Retry only when service startup or failover is an expected condition, and use bounded backoff.
POSIX connect() · RFC 9293: TCP · Linux UDP errors
Looking for a different code? Search another status or error code.
