DELAPARRA
Index
Color
NL
Category: Error types

ConnectionRefused

Explained by Updated

What is ConnectionRefused?

ConnectionRefused: The attempt to connect to a server was explicitly rejected — no service is listening on the target port. Connection refused means your program reached the target machine, but nothing was listening on that port. The operating system answered immediately with a rejection. That makes it a useful clue. The network path works. The problem is the service: it is not running, it crashed, it listens on a different port, or it only listens on 127.0.0.1 while you connect from elsewhere.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about ConnectionRefused

What should you keep in mind with ConnectionRefused?

In Docker setups, a classic cause is connecting to localhost from inside a container. Inside the container, localhost means the container itself, not your computer or the database container. Use the service name, such as mysql, instead. Also check whether the service was simply still starting; databases can take several seconds, and a quick retry or a health check fixes start-up order problems.

At a glance

CategoryError types
Explained by
Updated

More Error types terms

All terms starting with C

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.