#error 'disconnected (4008)'
1 messages Β· Page 1 of 1 (latest)
Yep β disconnected (4008): connect failed in Control UI is usually one of these:
- UI is pointing at wrong gateway URL/port
- token mismatch (CLI config vs running service config)
- stale browser auth state (Firefox can get wedged)
Can you run this in the VM and paste output?
openclaw --version
openclaw status
openclaw gateway status
openclaw config get gateway.auth.token
openclaw doctor
Then do this exactly:
- Open a fresh private window to
http://127.0.0.1:18789/(not VM IP/hostname) - In Control UI settings:
- Gateway URL:
ws://127.0.0.1:18789 - Token: paste value from
openclaw config get gateway.auth.token - Click Connect
If it still fails, run:
openclaw logs --follow
Click Connect once, then paste the lines with connect failed, AUTH_..., device identity, or unauthorized.
If openclaw gateway status shows Config (cli) and Config (service) are different, fix with:
openclaw gateway install --force
openclaw gateway restart
Docs:
Nice log, this is super useful.
Key signal: webchat connected appears before each 4008 connect failed. That means auth/URL are probably okay and the disconnect is likely happening on the browser client side right after connect (often stale UI state or Firefox-specific issue).
Try this exact sequence:
- Hard reset Control UI browser state
- Open
http://127.0.0.1:18789/ - Press
F12β Console, run:
localStorage.clear(); sessionStorage.clear(); location.reload();
- Re-enter token and connect.
-
Test another browser once (Chromium/Chrome)
If Chromium works, this is a Firefox client-state bug, not gateway config. -
Verify service/config alignment
openclaw gateway status
openclaw gateway probe
If gateway status shows CLI/service mismatch, run:
openclaw gateway install --force
openclaw gateway restart
- If still failing, send:
openclaw gateway statusoutput- browser DevTools Console error stack right after pressing Connect
(that should show the exact exception causing the client to close with 4008)
Refs:
Got it β thanks for sticking with it.
Given your logs (webchat connected then immediate 4008 connect failed), this looks like a Control UI client-side crash after successful handshake, not a VM/network reachability problem.
Letβs do one decisive split-check:
TOKEN="$(openclaw config get gateway.auth.token)"
openclaw gateway call status --url ws://127.0.0.1:18789 --token "$TOKEN" --json
openclaw gateway status --json
- If
gateway call statusreturns JSON successfully, gateway/auth are good and this is UI-side. - Then run:
openclaw doctor --repair
openclaw gateway restart