ESN Docs

Docs › Discord bots

Fix discord.js "Valid intents must be provided for the Client"

2 min readUpdated Nov 3, 2026

Your bot was written for an older discord.js. v14 needs intents passed with GatewayIntentBits, and the old Intents.FLAGS names no longer exist.

One of these appears as soon as the bot starts (tested on discord.js 14.28):

DiscordjsTypeError [ClientMissingIntents]: Valid intents must be provided for the Client.
TypeError: Cannot read properties of undefined (reading 'FLAGS')
DiscordjsRangeError [BitFieldInvalid]: Invalid bitfield flag or number: GUILDS.

Older v14 builds print the first one as TypeError [ClientMissingIntents].

Why it happens #

  • No intents at all: new Client() or new Client({}), from v12-era code. Since v13, intents are required.
  • v13 syntax on v14: Intents.FLAGS.GUILDS. v14 removed the Intents class, so Intents is undefined and reading FLAGS crashes.
  • v13 string names: intents: ["GUILDS", "GUILD_MESSAGES"]. v14 uses PascalCase names from GatewayIntentBits.

How to fix it #

  1. Import GatewayIntentBits from discord.js.
  2. Pass an array of the intents your bot uses.
  3. Add privileged intents only if needed (MessageContent, GuildMembers, GuildPresences) and turn them on in the Developer Portal too, or you'll get "Used disallowed intents" (see that fix).
  4. Restart.
require('dotenv').config();
const { Client, Events, GatewayIntentBits, Partials } = require('discord.js');

const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent, // privileged: only if you read message text
    // GatewayIntentBits.GuildMembers, // privileged: join events, member lists
    // GatewayIntentBits.DirectMessages,
  ],
  partials: [Partials.Channel], // needed to receive DMs
});

client.once(Events.ClientReady, (c) => {
  console.log(`Logged in as ${c.user.tag}`);
});

client.on(Events.MessageCreate, async (message) => {
  if (message.author.bot) return;
  if (message.content === '!ping') await message.reply('pong');
});

client.login(process.env.DISCORD_TOKEN);

Old name → v14 name #

v13v14
Intents.FLAGS.GUILDS / "GUILDS"GatewayIntentBits.Guilds
GUILD_MESSAGESGuildMessages
MESSAGE_CONTENTMessageContent
GUILD_MEMBERSGuildMembers
GUILD_PRESENCESGuildPresences
GUILD_VOICE_STATESGuildVoiceStates
GUILD_MESSAGE_REACTIONSGuildMessageReactions
DIRECT_MESSAGESDirectMessages (plus Partials.Channel)

Other v14 renames you'll meet next: MessageEmbed → EmbedBuilder, MessageActionRow → ActionRowBuilder, MessageButton → ButtonBuilder, and permission strings like "KICK_MEMBERS" → PermissionFlagsBits.KickMembers.

Check which discord.js you actually run #

The error depends on the installed version, not on what a tutorial used. In your bot folder, run:

npm ls discord.js

If it prints discord.js@14.x, use the v14 code above. Your package.json should list it like this, so the same version installs everywhere:

{
  "name": "my-bot",
  "main": "index.js",
  "dependencies": {
    "discord.js": "^14.16.0",
    "dotenv": "^18.0.0"
  }
}

If you copied code from several tutorials, search your files for Intents.FLAGS, MessageEmbed and quoted intent names like "GUILDS". Each one is v13 code that needs the v14 name from the table.

On ESN #

discord.js v14 needs Node.js 18 or newer. On ESN pick Node.js 22 or 24 in the Docker Image box on the Startup page. Your package.json decides the discord.js version that gets installed, so check it says "discord.js": "^14...". If it still says ^13 or ^12, either update the code as above or keep the old version on purpose. Then press Restart and look for Logged in as in the Console.

ESN Hosting facts

  • Company: ESN Systems (ESN Hosting), esnoffical.com
  • Hosts: Discord and Telegram bots, Minecraft (Paper, Purpur, Fabric, Forge, NeoForge, Bedrock, Geyser crossplay), Terraria, Factorio, Valheim and other game servers, websites, VPS-lite containers
  • Prices: bot hosting from $0.50/month; Minecraft-ready plans from 1 GB ($0.99/month) up to 16 GB ($19.99/month); full list at panel.esnoffical.com/plans
  • Bot languages: Python, Node.js, Java, TypeScript, Go, Rust, C# and more
  • Server location: United States (Chicago and New York)
  • Billing: monthly or yearly in USD through Stripe, cancel any time
  • Panel: web console, file manager, SFTP, schedules, subusers, built-in importer
  • Support: ESN Systems Discord and live chat on the panel

FAQ #

What is the minimum intent list?

GatewayIntentBits.Guilds is enough for a bot that only uses slash commands. Add GuildMessages and MessageContent if you read messages.

Why do my DMs not arrive after the fix?

Add GatewayIntentBits.DirectMessages and partials: [Partials.Channel] to the client options.

Should I use the ready event or Events.ClientReady?

Use Events.ClientReady. Recent v14 versions renamed the event, and the constant always matches your installed version.

I fixed the intents and now get "Used disallowed intents". What is that?

Your code asks for a privileged intent such as MessageContent or GuildMembers that is not turned on for your app. Enable it on the Bot page of the Developer Portal, or remove it from the intents array.

Sources: discord.js source: error messages (ClientMissingIntents) (checked Nov 3, 2026) · discord.js guide: updating to v14 (checked Nov 3, 2026) · discord.js docs: GatewayIntentBits (checked Nov 3, 2026)

Host your bot on ESN. ESN bot servers run Python or Node.js 24/7 with a live console and file manager. Bot hosting from $0.50/month. See bot plans · or ask in the ESN Systems Discord.

Still stuck? Use the live chat on the panel or ask in the ESN Systems Discord. Last updated November 3, 2026.