#unstable gateway connection
1 messages · Page 1 of 1 (latest)
even on openclaw tui, most of the times it just stopped after finishing a prompt, not showing anything
502 usually means the dashboard can’t reach the gateway anymore, so I’d check gateway health first, not a dashboard-only setting.
Please paste these when it happens:
openclaw --version
openclaw status --all
openclaw gateway status --deep
openclaw doctor
Then watch logs:
openclaw logs --follow
If RPC is fully down, use:
tail -f "$(ls -t /tmp/openclaw/openclaw-*.log | head -1)"
The common things to look for are:
- gateway process stopped/crashed
- service config and CLI config are different
- port conflict (
EADDRINUSE) - low memory / OOM on the host
- a proxy layer in front of OpenClaw (nginx, Caddy, Cloudflare, Tailscale Serve) returning the 502
One quick clue: if openclaw gateway status still shows Runtime: running and RPC probe: ok while the dashboard is broken, it may be the browser/WebSocket side instead of the gateway itself.
Docs:
https://docs.openclaw.ai/help/faq
https://docs.openclaw.ai/gateway/troubleshooting
If you paste the 4 command outputs, plus whether you’re opening the dashboard locally or through a reverse proxy/Tailscale, I can help narrow it down fast.
yeah, if both the dashboard and TUI stop behaving, that points much more to the gateway/RPC layer dying than to a dashboard-only issue.
Most important thing: check it while it’s broken, before restarting.
Please grab:
openclaw --version
openclaw status --all
openclaw gateway status
openclaw models status
openclaw logs --follow
A few high-signal things to look for:
openclaw gateway statussaysRuntime: runningbutRPC probe: failed
- that means the supervisor still sees a process, but the gateway itself is not actually responding
Config (cli)andConfig (service)are different- that means the service may be running a different config than the one you’re editing
- any
EADDRINUSE, crash, auth, or OOM/memory lines in logs
In the TUI, also try:
/status
If it’s just sitting there with no output, docs specifically say to check:
openclaw status
openclaw models status
openclaw logs --follow
Docs:
https://docs.openclaw.ai/help/faq#tui-shows-no-output-what-should-i-check
https://docs.openclaw.ai/help/faq#why-does-openclaw-gateway-status-say-runtime-running-but-rpc-probe-failed
https://docs.openclaw.ai/gateway/troubleshooting
If you paste the output from openclaw gateway status and the last bit of openclaw logs --follow, I can usually narrow this down pretty quickly.
let’s keep it in this thread first.
Before restarting again, please paste:
openclaw --version
openclaw status --all
openclaw gateway status
openclaw models status
openclaw logs --follow
The key is to capture it while it’s broken. If that points to an actual OpenClaw bug, the right escalation path is a GitHub issue here:
https://github.com/openclaw/openclaw/issues
That’ll get it in front of the team with the useful diagnostics attached.
08:48:53+00:00 error Gateway failed to start: another gateway instance is already listening on ws://127.0.0.1:18789 | listen EADDRINUSE: address already in use 127.0.0.1:18789
If the gateway is supervised, stop it with: openclaw gateway stop
08:48:53+00:00 error Port 18789 is already in use.
08:48:53+00:00 error - pid 955038 root: openclaw-gateway (127.0.0.1:18789)
08:48:53+00:00 error - Gateway already running locally. Stop it (openclaw gateway stop) or use a different port.
08:48:53+00:00 error Gateway service appears enabled. Stop it first.
08:48:53+00:00 error Tip: openclaw gateway stop
08:48:53+00:00 error Or: systemctl --user stop openclaw-gateway.service
08:48:55+00:00 warn gateway/ws {"subsystem":"gateway/ws"} Proxy headers detected from untrusted address. Connection will not be treated as local. Configure gateway.trustedProxies to restore local client detection behind your proxy.
nice, this log is actually very revealing.
You have two separate clues here:
-
EADDRINUSE/ another gateway instance is already listening- that means a gateway is already bound to
127.0.0.1:18789 - so when you “restart manually”, you may be trying to start a second gateway on top of the supervised service
- that means a gateway is already bound to
-
Proxy headers detected from untrusted address- that means something is sitting in front of OpenClaw as a proxy
- OpenClaw is seeing forwarded headers, but does not trust that proxy IP for local-client detection
So I’d avoid changing random settings for now. First normalize the setup:
- if you installed the service, use only:
openclaw gateway stop
openclaw gateway start
- don’t also launch a separate manual gateway process on the same port
Next, please paste:
openclaw --version
openclaw gateway status
The important lines in openclaw gateway status are:
RuntimeRPC probe
Probe targetListeningConfig (cli)Config (service)
If Config (cli) and Config (service) are different, that’s a very common cause of weird flaky behavior.
Also, are you using nginx, Caddy, Cloudflare, or Tailscale Serve in front of OpenClaw?
Because the proxy warning suggests this may be the real split:
- if
http://127.0.0.1:18789/works directly, but your proxied URL gives 502, the problem is probably the proxy layer - if both break, it’s the gateway/service
Relevant docs:
https://docs.openclaw.ai/help/faq#what-does-another-gateway-instance-is-already-listening-mean
https://docs.openclaw.ai/help/faq#why-does-openclaw-gateway-status-show-config-cli-and-config-service-different
https://docs.openclaw.ai/gateway/trusted-proxy-auth
Paste openclaw gateway status and what proxy you’re using, and I think we can narrow this down pretty fast.
🦞 OpenClaw 2026.4.21 (f788c88) — The only open-source project where the mascot could eat the competition.
│
â—‡
Service: systemd (enabled)
File logs: /tmp/openclaw/openclaw-2026-04-22.log
Command: /root/.nvm/versions/node/v25.5.0/bin/node /root/.nvm/versions/node/v25.5.0/lib/node_modules/openclaw/dist/index.js gateway --port 18789
Service file: ~/.config/systemd/user/openclaw-gateway.service
Service env: OPENCLAW_GATEWAY_PORT=18789
Service config looks out of date or non-standard.
Service config issue: Gateway service PATH includes version managers or package managers; recommend a minimal PATH. (/root/.nvm/versions/node/v25.5.0/bin)
Service config issue: Gateway service uses Node from a version manager; it can break after upgrades. (/root/.nvm/versions/node/v25.5.0/bin/node)
Recommendation: run "openclaw doctor" (or "openclaw doctor --repair").
Config (cli): ~/.openclaw/openclaw.json
Config (service): ~/.openclaw/openclaw.json
Gateway: bind=loopback (127.0.0.1), port=18789 (service args)
Probe target: ws://127.0.0.1:18789
Dashboard: http://127.0.0.1:18789/
Probe note: Loopback-only gateway; only local clients can connect.
Runtime: running (pid 957459, state active, sub running, last exit 0, reason 0)
Connectivity probe: ok
Capability: admin-capable
Listening: 127.0.0.1:18789
Troubles: run openclaw status
Troubleshooting: https://docs.openclaw.ai/troubleshooting
this narrows it down a lot.
Your gateway itself looks healthy in that snapshot:
Config (cli)andConfig (service)matchRuntime: runningConnectivity probe: okListening: 127.0.0.1:18789
So the earlier EADDRINUSE was just you trying to start a second gateway while the systemd service was already running.
The more likely issue now is the proxy path, especially because you also got:
Proxy headers detected from untrusted address
And your gateway is loopback-only, so if you are opening the dashboard from anywhere other than the same machine, it has to be going through some proxy/tunnel.
What I’d check next
When the 502 happens again, on the server run:
openclaw gateway status
curl -I http://127.0.0.1:18789/
If 127.0.0.1:18789 still works locally, but your normal dashboard URL returns 502, then the problem is almost certainly nginx / Caddy / Cloudflare / Tailscale Serve / whatever is in front, not the OpenClaw gateway.
One more thing
openclaw gateway status is also warning that your systemd service is using nvm-managed Node and looks a bit non-standard. That is worth cleaning up, even if it is not the direct 502 cause.
I’d run:
openclaw doctor
and if it still flags the service config, then:
openclaw doctor --repair
Please send these two details
- What URL are you opening when you get the 502?
- Are you using nginx, Caddy, Cloudflare, or Tailscale Serve in front of it?
Docs:
https://docs.openclaw.ai/help/faq#how-do-i-authenticate-the-dashboard-on-localhost-vs-remote