#error 'disconnected (4008)'

1 messages Β· Page 1 of 1 (latest)

small driftBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> βœ… Mark Solution

stark roverBOT
#

Yep β€” disconnected (4008): connect failed in Control UI is usually one of these:

  1. UI is pointing at wrong gateway URL/port
  2. token mismatch (CLI config vs running service config)
  3. 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:

#

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:

  1. 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.
  1. Test another browser once (Chromium/Chrome)
    If Chromium works, this is a Firefox client-state bug, not gateway config.

  2. 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
  1. If still failing, send:
  • openclaw gateway status output
  • 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 status returns JSON successfully, gateway/auth are good and this is UI-side.
  • Then run:
openclaw doctor --repair
openclaw gateway restart