#disconnected (1006): no reason

1 messages · Page 1 of 1 (latest)

bronze solstice
#

i used whatsapp when i set up in macos terminal, however when i added discord, it keeps bouncing between health ok to offline, then tells me disconnected (1006): no reason

molten galeBOT
#

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

timid oakBOT
#

disconnected (1006): no reason is almost always the UI/WebSocket losing its connection to the Gateway (i.e. the Gateway is restarting/crashing, or you’re accidentally running two gateways, or the network link is dropping) — it’s not a “Discord-specific error” by itself. Docs: https://docs.openclaw.ai/help/faq#disconnected-from-gateway-no-reason-what-now

A couple quick things to check on macOS (super common):

  1. Version first (important):
openclaw --version
  1. Make sure you’re not running two gateways
  • If you have the daemon installed (launchd), don’t also run openclaw gateway in a terminal.
    Check:
openclaw gateway status

If Config (cli) and Config (service) differ, or you’ve got one running in terminal + one as a service, you can get “online/offline” flapping.

#
  1. If your Discord token is only in your shell env, launchd won’t see it
    On macOS, the service often does not inherit your terminal env/.zshrc. So Discord can “work” in terminal runs but fail when the service runs.
    Prefer putting the token in config:
channels: {
  discord: { enabled: true, token: "..." }
}

Discord docs: https://docs.openclaw.ai/channels/discord

  1. Grab the 2 outputs that usually pinpoint the cause
    These are safe to paste (tokens are redacted):
openclaw status --all
openclaw logs --follow

When it flips offline / disconnects, copy ~30 lines around the error from the logs.

#

If you paste:

  • openclaw --version
  • openclaw gateway status
  • the log snippet from when it drops

…I can tell you whether it’s (a) env/config mismatch, (b) gateway crash loop, (c) duplicate gateway instances, or (d) network/sleep related.

bronze solstice
#
  1. 2026.2.19-2
  2. jarvis@JarvisdeMac-mini ~ % openclaw gateway status

🦞 OpenClaw 2026.2.19-2 (45d9b20) — Your AI assistant, now without the $3,499 headset.

│
gateway connect failed: Error: pairing required
â—‡
Service: LaunchAgent (loaded)
File logs: /tmp/openclaw/openclaw-2026-02-21.log
Command: /opt/homebrew/Cellar/node@22/22.22.0/bin/node /opt/homebrew/lib/node_modules/openclaw/dist/index.js gateway --port 18789
Service file: ~/Library/LaunchAgents/ai.openclaw.gateway.plist
Service env: OPENCLAW_GATEWAY_PORT=18789

Config (cli): ~/.openclaw/openclaw.json
Config (service): ~/.openclaw/openclaw.json

Gateway: bind=loopback (127.0.0.1), port=18789 (service args)
Probe target: ws://127.0.0.1:18789
Dashboard: http://127.0.0.1:18789/
Probe note: Loopback-only gateway; only local clients can connect.

Runtime: running (pid 15075, state active)
Warm-up: launch agents can take a few seconds. Try again shortly.
RPC probe: failed
RPC target: ws://127.0.0.1:18789
gateway closed (1008): pairing required
Gateway target: ws://127.0.0.1:18789
Source: cli --url
Config: /Users/jarvis/.openclaw/openclaw.json

Port 18789 is already in use.

  • pid 15075 jarvis: openclaw-gateway (127.0.0.1:18789)
  • Gateway already running locally. Stop it (openclaw gateway stop) or use a different port.
    Listening: 127.0.0.1:18789
    Troubles: run openclaw status
    Troubleshooting: https://docs.openclaw.ai/troubleshooting
timid oakBOT
#

That openclaw gateway status output is the smoking gun:

  • Gateway process is running
  • but the WS RPC probe is getting closed with (1008): pairing required

So the “offline / disconnected (1006)” you’re seeing is very likely just the client/UI getting kicked because the Gateway wants device pairing approval.

1) Approve the pending Control UI / CLI device

Open the dashboard once (so it generates a pairing request), then in Terminal run:

openclaw devices list
openclaw devices approve <requestId>

Then reload the Control UI page and re-try:

#
openclaw gateway status

Docs: https://docs.openclaw.ai/web/control-ui#device-pairing-first-connection

2) Separate issue: Discord token probably isn’t available to the LaunchAgent

Your service env only shows OPENCLAW_GATEWAY_PORT — on macOS, LaunchAgents usually don’t inherit the env vars you had in Terminal. If you set Discord up via DISCORD_BOT_TOKEN=... in your shell, the daemon won’t see it.

Recommended: put the token directly in ~/.openclaw/openclaw.json:

{
  channels: {
    discord: {
      enabled: true,
#
      token: "YOUR_BOT_TOKEN"
    }
  }
}

Then restart the service:

openclaw gateway restart

If openclaw devices list also fails

Paste what it prints, and also paste ~30 lines around the disconnect from:

/tmp/openclaw/openclaw-2026-02-21.log