Gateway Keeps Crashing / Restart Loop
Error: Gateway crashed / restart loop detected / abnormal WebSocket closure (code 1006)
OpenClaw troubleshooting · Updated 2026
Error Message
Error: Gateway crashed / restart loop detected / abnormal WebSocket closure (code 1006)
What Causes This
The gateway starts but immediately crashes, often due to a plugin loading error, corrupted state, or environment variables missing in the service context. Code 1006 (abnormal closure) often points to a plugin issue.
How to Fix It
Isolate the crash cause:
# Run in foreground to see the error directly
openclaw gateway start --foreground
# If it's a plugin issue, disable all plugins temporarily:
# In openclaw.json, set all plugin entries to enabled: false
# Then restart and re-enable one at a time
# If it's a stale lock:
rm ~/.openclaw/gateway.pid
openclaw gateway start
# If the daemon can't find env vars:
# Ensure API keys are in the config (not just shell env)
# For systemd: add Environment= lines to the service file
# For launchd: add EnvironmentVariables to the plist
# Nuclear: reinstall service
openclaw gateway install --force
openclaw gateway restart
Fixed in v2026.2.22+: a known restart loop bug was patched. If you're on an older version, update first: npm install -g openclaw@latest.