n8n errors / Connectivity

connect ECONNREFUSED 127.0.0.1:5432

platform: n8n / category: Connectivity

Cause

The Postgres node cannot reach the database, typically because n8n is in Docker and the host is set to localhost/127.0.0.1 instead of the container name.

Fix

In Docker Compose, set the credential host to the Postgres service name (e.g. postgres), not localhost. Confirm port 5432 is exposed and pg_hba.conf/postgresql.conf allow remote connections from the n8n network. If using an SSH tunnel, upgrade to n8n v1.99.0 for the connection-pool fix.

Source thread →

Part of the Automation Error Index — n8n errors: browse all.

Hitting an automation error we have not covered?

AutomateLab builds and debugs n8n, Make, and agent workflows as fixed-scope projects. If something is broken in production, tell us what you are seeing.

Describe the problem