Contents
A Discord bot receives events over a persistent gateway connection (a WebSocket), and when it connects, your code declares its intents: the event types it wants. Three of them are privileged because they expose user data, and Discord only accepts them after you switch them on for that application. Request one without enabling it and the connection is closed immediately, before the bot handles a single command.
What the error looks like
| Library | Message |
|---|---|
| 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. |
| Raw gateway | close code 4014 (Disallowed intent(s)) |
The privileged intents are:
- Server Members Intent (
GuildMembersin discord.js,membersin discord.py): member joins, leaves and the member list. - Presence Intent (
GuildPresences/presences): user status and activity. - Message Content Intent (
MessageContent/message_content): the text and attachments of ordinary messages.
Causes
- The intent is enabled in code but not in the Developer Portal, or you never clicked Save Changes.
- The token on the server belongs to another application (a test bot and a production bot, for example) and only one has the intent enabled.
- The code asks for everything at once, such as
discord.Intents.all()or an array of everyGatewayIntentBitsvalue. - The bot is in 100 or more servers, so it needs verification, and privileged intents are then granted only through a request Discord approves.
How to fix it
1. Enable the intent in the Developer Portal
- Open
discord.com/developers/applicationsand pick the bot’s application. - Choose Bot in the sidebar.
- Under Privileged Gateway Intents, enable only what the bot actually uses.
- Click Save Changes.
2. Request only what you enabled
discord.js (v14):
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent, // must be enabled in the Developer Portal
],
});
client.login(process.env.DISCORD_TOKEN);
discord.py:
import os
import discord
from discord.ext import commands
intents = discord.Intents.default() # excludes privileged intents
intents.message_content = True # must be enabled in the Developer Portal
bot = commands.Bot(command_prefix="!", intents=intents)
bot.run(os.environ["DISCORD_TOKEN"])
3. Restart the bot
The new setting applies on the next connection, so stop the process, start it again and watch the log until the ready event fires.
Still failing after enabling it?
- Compare the Application ID on the portal page with the application the token belongs to. The bot may be reading an old token from a
.envfile or from environment variables. - If the bot only uses slash commands, drop
MessageContentfrom the code entirely; those commands don’t need it. - Make sure you’re editing the file the server actually runs, not a copy in another folder.
Prevention
- Request the fewest intents possible; it makes verification easier once the bot grows.
- Note in the README which intents each application (test and production) needs.
- Keep the token in an environment variable, never in code or in the repository.
- Send the bot’s output to a log file so you can see at once why it stopped.
On ArabyHost
A Discord bot needs a process that runs all the time, so it belongs on the AI/Developer plans, which include SSH, Node.js 20 and 24, and Python 3.9 to 3.12. The bot runs as a background worker kept alive by a cron job that restarts it if it stops, as shown in the Discord bot guide; if that job never fires, see cron job not running. This particular error has nothing to do with the server, though: it is always fixed in the Developer Portal or in your code. If the bot stops for some other reason, the Araby AI assistant in the panel reads the error log and explains the cause. For what a bot needs to run, see Discord bot hosting.
FAQ
Why does my bot work locally but fail with this error on the server?
The setting belongs to the bot's application in the Developer Portal, not to the machine. Usually the server uses a different application's token (a production bot, say) where the intents aren't enabled, or runs an older copy of the code.
Do I need the Message Content intent for slash commands?
No. Slash command interactions arrive with their data without it. You only need Message Content if the bot reads the text of ordinary messages, such as prefix commands starting with !.
What's the difference between close codes 4013 and 4014?
4013 means the intents value itself is invalid, usually a miscalculated bitfield. 4014 means the intent is valid but not allowed for this bot because it isn't enabled or approved.