The Dreaded Error 4014
If you’ve connected a Discord bot to OpenClaw, you’ve almost certainly seen this in your gateway logs:
[openclaw] Uncaught exception: Error: Fatal Gateway error: 4014
at GatewayPlugin.handleReconnectionAttemptThis error crashes the entire OpenClaw gateway process, triggers a restart, and then the same error immediately recurs — creating an infinite crash-restart loop. Let’s understand exactly what’s happening and how to fix it.
What Error 4014 Means
Discord’s WebSocket Gateway uses numeric close codes to communicate disconnection reasons. Code 4014 specifically means:
Disallowed intent(s). You sent a privileged intent that your bot hasn’t been approved for or hasn’t been enabled in the Discord Developer Portal.
OpenClaw’s Discord integration (via the @buape/carbon library) requests the Message Content Intent — a privileged intent that Discord requires explicit opt-in for since September 2022.
The Log Sequence
Here’s the typical crash sequence from real logs:
[discord] [default] Discord Message Content Intent is disabled;
bot may not respond to channel messages.
Enable it in Discord Dev Portal (Bot → Privileged Gateway Intents)
or require mentions.
[discord] [default] starting provider (@openclaw)
[openclaw] Uncaught exception: Error: Fatal Gateway error: 4014
at GatewayPlugin.handleReconnectionAttempt
at GatewayPlugin.handleClose
at WebSocket.<anonymous>Notice that OpenClaw warns you about the missing intent before the crash, but proceeds to connect anyway. Discord then immediately disconnects the bot with code 4014.
The Crash-Restart Loop
What makes this particularly disruptive is the cascade:
- Gateway starts and connects to Discord
- Discord disconnects with code 4014
- OpenClaw catches the uncaught exception and crashes
- Docker’s
restart: unless-stoppedpolicy restarts the container - Go to step 1 — the loop repeats indefinitely
During restarts, the gateway is completely unavailable — not just Discord, but all functionality including the Control UI and WebSocket API:
$ curl -I http://127.0.0.1:18789
curl: (56) Recv failure: Connection reset by peerEven docker compose logs may show empty output right after a restart because the container hasn’t had time to produce any log lines yet.
Auto-Restart Behavior
OpenClaw also has its own internal retry mechanism. After the first 4014 error, you’ll see:
[discord] logged in to discord as 1476339958796259550
[discord] gateway: WebSocket connection closed with code 4014
[discord] gateway closed with code 4014 (missing privileged gateway intents).
Enable the required intents in the Discord Developer Portal
or disable them in config.
[discord] [default] auto-restart attempt 1/10 in 5sEach retry triggers another 4014, another crash, another Docker restart. This means a single missing checkbox in the Discord Developer Portal can make your entire OpenClaw deployment unreachable.
The Fix: Enable Message Content Intent
Step 1: Open the Discord Developer Portal
Navigate to https://discord.com/developers/applications and select your bot application.
Step 2: Enable the Intent
Go to Bot → Privileged Gateway Intents and toggle on:
- Message Content Intent ✅
For bots in fewer than 100 servers, this can be enabled immediately without verification. For larger bots, you’ll need to apply for approval.
Step 3: Restart OpenClaw
docker compose down
docker compose up -dStep 4: Verify the Fix
Check the logs for the success message:
docker logs --tail=20 openclaw-openclaw-gateway-1You should see:
[discord] [default] Discord Message Content Intent is limited;
bots under 100 servers can use it without verification.
[discord] [default] starting provider (@openclaw)
[discord] logged in to discord as 1476339958796259550No more 4014 errors. The gateway stays up.
Alternative: Disable Discord Entirely
If you don’t need Discord and just want a stable gateway, disable the channel:
docker compose run --rm openclaw-cli config set channels.discord.enabled false
docker compose down && docker compose up -dVerify it’s disabled:
docker compose run --rm openclaw-cli config get channels.discord.enabled
# Output: falseWith Discord disabled, the gateway starts cleanly without any Discord-related log lines.
Common Pitfall: Config Path Migration
If you try to disable Discord using the old config path:
docker compose run --rm openclaw-cli config set discord.enabled falseYou’ll get:
Error: Config validation failed: discord: discord config moved
to channels.discord (auto-migrated on load).OpenClaw v2026.2.25 moved the Discord config under channels.discord. Always use the new path:
docker compose run --rm openclaw-cli config set channels.discord.enabled falseQuick Diagnostic Checklist
| Symptom | Cause | Fix |
|---|---|---|
Fatal Gateway error: 4014 | Missing privileged intent | Enable Message Content Intent in Discord Dev Portal |
Connection reset by peer on curl | Gateway restarting in crash loop | Fix underlying 4014 or disable Discord |
Empty docker compose logs | Container just restarted | Wait a few seconds and retry |
auto-restart attempt 1/10 | Internal retry before crash | Same fix — enable intent or disable Discord |
Config validation failed: discord: | Using old config path | Use channels.discord.enabled instead |

