ECONNREFUSED in CI
The test process reached the target host, but no service was accepting connections on the requested port.
RECOGNIZABLE ERROR
Error: connect ECONNREFUSED 127.0.0.1:5432RANKED DIAGNOSIS
What usually causes it
- 01
The dependency never became ready
A database, API, or web server started slowly or crashed during boot.
DIAGNOSE
Read the dependency logs and probe its health endpoint before running tests.
FIX
Gate the suite on a bounded health check and fail with the dependency logs.
- 02
localhost points at the wrong container
Inside a container, 127.0.0.1 refers to that container rather than another service.
DIAGNOSE
Print the resolved base URL and compare it with the CI service name and network.
FIX
Use the CI service hostname or expose the correct host gateway.
- 03
The configured port differs from the listening port
Environment variables and container mappings can disagree.
DIAGNOSE
Compare the application listen address, health check, and test base URL.
FIX
Use one validated configuration value and publish the correct container port.
Prevent the repeat
- →Use explicit health checks.
- →Validate base URLs at suite startup.
- →Attach service logs on failure.
Primary references
Run this against your evidence
The browser triage workflow uses the same stable pattern slug and does not upload your paste.