ClawKit Logo
ClawKitReliability Toolkit

Fix Discord Gateway Error 4014: Crash Loop

[Discord] WebSocket closed: 4014 Disallowed intent
[Gateway] Uncaught exception: WebSocket was closed before the connection was established
[Gateway] Restarting Discord channel...

Error 4014 is a configuration error, not a network error. Restarting OpenClaw will not fix it. The fix must be made in the Discord Developer Portal first.

Discord gateway close code 4014 means your bot is requesting a privileged intent that isn't enabled in the Discord Developer Portal. OpenClaw needs MESSAGE_CONTENT intent to read messages. Without it, the gateway rejects every connection and OpenClaw falls into a crash-restart loop.

Next Step

Fix now, then reduce repeat incidents

If this issue keeps coming back, validate your setup in Doctor first, then harden your config.

Step 1: Enable Privileged Intents in Discord Developer Portal

1

Go to discord.com/developers/applications and select your bot application.

2

Click "Bot" in the left sidebar.

3

Scroll down to "Privileged Gateway Intents".

4

Enable "Message Content Intent" (required for OpenClaw to read messages). Also enable "Server Members Intent" if your bot uses member information.

5

Click "Save Changes" at the bottom of the page.

Quick link

Direct link to your bot settings: discord.com/developers/applications/YOUR_APP_ID/bot

Step 2: Verify Intents in openclaw.json

Make sure your OpenClaw Discord channel config requests the correct intents:

Discord channel config in openclaw.json
{
  "channels": {
    "discord": {
      "token": "YOUR_BOT_TOKEN",
      "intents": [
        "Guilds",
        "GuildMessages",
        "MessageContent",
        "DirectMessages"
      ]
    }
  }
}

MessageContent in the config and enabling "Message Content Intent" in the Developer Portal are both required. One without the other will not work.

For Bots in 100+ Servers: Verification Required

If your bot is in more than 100 servers, Discord requires you to go through a bot verification process before privileged intents can be enabled. This is a manual review by Discord. During verification, consider using an alternative approach:

Limit intents to non-privileged while awaiting verification
{
  "channels": {
    "discord": {
      "token": "YOUR_BOT_TOKEN",
      "intents": [
        "Guilds",
        "GuildMessages",
        "DirectMessages"
      ],
      "dmPolicy": "all"
    }
  }
}

Without MessageContent, the bot can still respond to DMs and slash commands, but cannot read message content in guilds.

Step 3: Restart and Verify

Restart OpenClaw gateway
openclaw gateway restart

# Check logs โ€” should NOT see 4014 anymore:
openclaw gateway logs --follow

After enabling the intent and restarting, the gateway should connect without close code 4014. Your bot should appear online in Discord within a few seconds.

Did this guide solve your problem?