Skip to content
n8n · error message

n8n: Connection refused (ECONNREFUSED)

ConfigurationErrors from external services

Last verified

The exact message
connect ECONNREFUSED 127.0.0.1:8080

What it means

ECONNREFUSED means n8n reached the host, but nothing was listening on the target port, so the operating system refused the connection. The n8n docs cover it in the HTTP Request node's common issues, and it is especially common with self-hosted n8n in Docker.

Inside a Docker container, localhost and 127.0.0.1 mean the n8n container itself, not your computer or another container. A service running on the host or in another container is therefore "refused". The docs also note that on Node.js 17 and later, localhost can resolve to IPv6 first, so using 127.0.0.1 avoids a mismatch when the service only listens on IPv4.

What is not wrong: credentials and request format. The connection never opened.

What it looks like

# docker-compose.yml (Linux)
services:
  n8n:
    extra_hosts:
      - "host.docker.internal:host-gateway"

Why it happens

  • Calling localhost from inside the n8n container to reach a service on the host.
  • Using localhost instead of the service name to reach another container in the same Compose stack.
  • The target service is not running or listens on a different port.
  • IPv6/IPv4 mismatch when using localhost on newer Node.js versions.

How to fix it

  1. For a service on your Docker Desktop host, use host.docker.internal in the URL.
  2. On Linux, add a host.docker.internal host-gateway mapping to the n8n container.
  3. For another container in the same Compose stack, use its service name and internal port.
  4. Test from inside the container with wget against the same URL.
  5. On n8n Cloud, expose local services through a tunnel and use the public URL.

How to stop it recurring

Use service names for container-to-container calls, document which services n8n depends on, and add health checks so the target is up before workflows run.

Official documentation: docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/common-issues. See all n8n error messages or the n8n limits and quotas.

Related errors

Definitions

Quick answers

What does "Connection refused (ECONNREFUSED)" mean in n8n?

ECONNREFUSED means n8n reached the host, but nothing was listening on the target port, so the operating system refused the connection. The n8n docs cover it in the HTTP Request node's common issues, and it is especially common with self-hosted n8n in Docker. Inside a Docker container, localhost and 127.0.0.1 mean the n8n container itself, not your computer or another container.

How do I fix "Connection refused (ECONNREFUSED)"?

1. For a service on your Docker Desktop host, use host.docker.internal in the URL. 2. On Linux, add a host.docker.internal host-gateway mapping to the n8n container. 3. For another container in the same Compose stack, use its service name and internal port. 4. Test from inside the container with wget against the same URL. 5. On n8n Cloud, expose local services through a tunnel and use the public URL.

Error handling you can see in the workflow

Autonoly workflows have per-node retries, timeouts, continue-on-fail and error-handler branches, so a failing step can be retried or routed instead of stopping the whole run. Saved workflows have no loop node; lists are worked through by the AI agent or one run per trigger item.

Also see Visual workflow builder.