Disconnections are usually configuration mismatches, not random network issues. Start with the exact close code and reason.
Error code 1008 (policy violation)
Typical causes:
- Missing gateway token.
- Device token mismatch.
- Origin not allowed.
- Secure-context requirement (HTTP vs HTTPS).
Fix path:
- Re-open dashboard with tokenized URL.
- Approve pending device pairing request.
- Confirm exact origin in
gateway.controlUi.allowedOrigins. - For remote browser usage, run over HTTPS.
Error code 1006 (abnormal closure)
Typical causes:
- Upstream proxy target/port mismatch.
- Container restart loop.
- Process crash before handshake completes.
Fix path:
- Verify gateway container is healthy.
- Verify reverse proxy upstream to correct host/port.
- Check restart and error logs around close time.
Quick triage command set
docker ps
docker logs --tail 200 openclaw
docker exec openclaw node openclaw.mjs devices list --json
docker exec openclaw node openclaw.mjs gateway status
Keep a short incident template with code, reason, timestamp, origin, and change history. This shortens time-to-resolution dramatically.