Skip to main content
🎤 Speaking at KubeCon EU 2026 Lessons Learned Orchestrating Multi-Tenant GPUs on OpenShift AI View Session
🎤 Speaking at Red Hat Summit 2026 GPUs take flight: Safety-first multi-tenant Platform Engineering with NVIDIA and OpenShift AI Learn More
OpenClaw Discord Error 4014 Privileged Gateway Intents troubleshooting
AI

OpenClaw Discord Error 4014 Fix

Troubleshooting the Fatal Gateway error 4014 in OpenClaw's Discord integration. Learn what Privileged Gateway Intents are, why the 4014 crash loop happens, and.

LB
Luca Berton
· 3 min read

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.handleReconnectionAttempt

This 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:

  1. Gateway starts and connects to Discord
  2. Discord disconnects with code 4014
  3. OpenClaw catches the uncaught exception and crashes
  4. Docker’s restart: unless-stopped policy restarts the container
  5. 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 peer

Even 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 5s

Each 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 BotPrivileged 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 -d

Step 4: Verify the Fix

Check the logs for the success message:

docker logs --tail=20 openclaw-openclaw-gateway-1

You 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 1476339958796259550

No 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 -d

Verify it’s disabled:

docker compose run --rm openclaw-cli config get channels.discord.enabled
# Output: false

With 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 false

You’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 false

Quick Diagnostic Checklist

SymptomCauseFix
Fatal Gateway error: 4014Missing privileged intentEnable Message Content Intent in Discord Dev Portal
Connection reset by peer on curlGateway restarting in crash loopFix underlying 4014 or disable Discord
Empty docker compose logsContainer just restartedWait a few seconds and retry
auto-restart attempt 1/10Internal retry before crashSame fix — enable intent or disable Discord
Config validation failed: discord:Using old config pathUse channels.discord.enabled instead

Series Navigation

Luca Berton Ansible Pilot Ansible by Example Open Empower K8s Recipes Terraform Pilot CopyPasteLearn ProteinLens TechMeOut