← Back to Blog

Troubleshooting OpenClaw Disconnections (1006/1008)

A direct runbook to resolve the most common gateway connection failures.

Disconnections are usually configuration mismatches, not random network issues. Start with the exact close code and reason.

Debugging connectivity issues

Error code 1008 (policy violation)

Typical causes:

  • Missing gateway token.
  • Device token mismatch.
  • Origin not allowed.
  • Secure-context requirement (HTTP vs HTTPS).

Fix path:

  1. Re-open dashboard with tokenized URL.
  2. Approve pending device pairing request.
  3. Confirm exact origin in gateway.controlUi.allowedOrigins.
  4. 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:

  1. Verify gateway container is healthy.
  2. Verify reverse proxy upstream to correct host/port.
  3. 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.