OpenClaw Config Hell: Resolving the 'Gateway Connection Refused' Error
The 'Connection Refused' error is the most common blocker for new OpenClaw users. Here is the step-by-step fix involving port 18789 and proper daemon management.
You've installed OpenClaw, you're ready to automate your life, and then... Error: connect ECONNREFUSED 127.0.0.1:18789. This specific error accounts for 40% of GitHub issues in the OpenClaw repo. Let's fix it.
1. The Daemon isn't Running
The OpenClaw CLI is just a client; it needs the Gateway server running. If you skipped the --install-daemon flag during onboarding, the server dies when you close your terminal.
Fix: Run openclaw gateway --daemon or check the status with:
openclaw doctor
2. Port 18789 Conflict
OpenClaw defaults to port 18789. If you have a zombie process or another instance running, it will crash. Check what's using the port:
lsof -i :18789
Kill the PID and restart.
3. Tailscale Confusion
If you enabled gateway.tailscale.mode: "serve", OpenClaw might be binding specifically to the Tailscale interface IP instead of localhost. In this case, 127.0.0.1 won't work.
Fix: Check your `openclaw.json` and ensure gateway.bind is set to "loopback" if you want local access, or use your Tailscale IP to connect.
Master AI Engineering Today 🏗️
Join 50,000+ developers getting high-signal technical briefings. Zero AI slop, just engineering patterns.