Discord · 4014

Discord error 4014: disallowed intents

Your bot asked Discord for a privileged intent that has not been switched on for it, so Discord refused the connection. The fix takes one click, or one line of code.

← All errors

What you are seeing

discord.js

Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted.

discord.py

discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal.

Gateway

WebSocket closed with code 4014: Disallowed intent(s)

What it means

When a bot connects, it lists the groups of events it wants: its intents. Three of them are privileged — Server Members, Presences and Message Content — and a bot may only request those if they are also switched on for it in the Developer Portal. Request one that is not, and Discord closes the connection immediately with code 4014.

It happens at login, before any of your code runs, which is why the bot never comes online at all rather than half-working.

Fix it in the Developer Portal

Open discord.com/developers/applications, choose your application, then Bot in the sidebar. Under Privileged Gateway Intents, switch on each intent your code requests and save. Start the bot again; there is nothing to wait for.

To see which ones your code requests, look for GuildMembers, GuildPresences or MessageContent in discord.js, or members, presences or message_content set to True in discord.py. Intents.all() in discord.py requests all three.

Or stop asking for it

Switching an intent on is only right if the bot uses it. A bot that answers slash commands needs none of the three: interactions arrive whatever intents are requested. Removing an intent you do not use also saves memory, because the library stops caching what it would have received.

discord.js

const { Client, GatewayIntentBits } = require('discord.js');

// Enough for slash commands. Add MessageContent only if you read message text.
const client = new Client({ intents: [GatewayIntentBits.Guilds] });

discord.py

import discord

# default() leaves out all three privileged intents.
intents = discord.Intents.default()
client = discord.Client(intents=intents)

FAQ

Questions

I switched the intent on and still get 4014.

Check that you saved the change on the Bot page, and that you edited the same application whose token your bot uses. It is easy to have two applications with similar names and to be looking at the wrong one.

My bot is in over 100 servers and the switch is greyed out.

Once a bot is in 100 or more servers it has to be verified, and privileged intents must be applied for and approved by Discord. Until they are approved, remove them from your code so the bot can connect.