Discord · 50013

Discord error 50013: Missing Permissions

Discord refused an action because your bot is not allowed to do it here. Usually it has the permission and something else is in the way. Here is how to find what.

← All errors

What you are seeing

discord.js

DiscordAPIError[50013]: Missing Permissions

discord.py

discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

The four usual causes

The permission is missing. The bot's role simply does not have it. Check Server Settings, Roles, and the role named after your bot.

A channel overrides it. A server-wide permission can be denied in a single channel. If the error only happens in some channels, open that channel's settings, Permissions, and look for a red cross against the bot's role or @everyone.

The role order is wrong. A bot can only kick, ban, time out, rename or change the roles of a member whose highest role is below its own, and can only hand out roles below its own. Drag the bot's role above the roles it manages in Server Settings, Roles. This is the most common cause by far, and the one that makes people sure the bot "has the permission".

The target is the owner. Nothing can kick, ban, time out or rename the server owner, whatever its permissions.

Check before you act

Rather than letting the request fail, check first and tell the user why. Both libraries can answer "could I do this?" without asking Discord.

discord.js

const { PermissionFlagsBits } = require('discord.js');

if (!interaction.appPermissions.has(PermissionFlagsBits.BanMembers)) {
    return interaction.reply({ content: 'I need the Ban Members permission here.', ephemeral: true });
}

// Also false when the member outranks the bot, or is the owner.
if (!member.bannable) {
    return interaction.reply({ content: 'My role is below theirs.', ephemeral: true });
}

discord.py

me = interaction.guild.me

if not interaction.channel.permissions_for(me).ban_members:
    return await interaction.response.send_message("I need the Ban Members permission here.", ephemeral=True)

if member.top_role >= me.top_role or member == interaction.guild.owner:
    return await interaction.response.send_message("My role is below theirs.", ephemeral=True)

FAQ

Questions

The bot has Administrator and still gets 50013.

Administrator skips permission checks, but not the role order. An administrator bot still cannot act on members above it or on the owner, and still cannot assign a role above its own.

Is 50013 the same as 50001 Missing Access?

No. 50001 means the bot cannot see the channel or server at all. 50013 means it can see it but is not allowed to do this particular thing there.

Which permissions does my bot need?

Only the ones its commands use. The permissions calculator lists them all and builds an invite link that asks for exactly what you tick.