
Your bot tries to give someone a role, post in a channel or time out a spammer, and the console prints DiscordAPIError[50013]: Missing Permissions, or DiscordAPIError[50001]: Missing Access. You gave the bot the permission, maybe even Administrator, so why does Discord still say no? Because Discord also compares role positions and applies every channel overwrite. Here is how to find the check that failed, in Discord's settings and in code, for discord.js 14.28.0 and discord.py 2.7.1, the latest releases on 3 November 2026.
Quick answer: DiscordAPIError[50013]: Missing Permissions means Discord refused the action because the bot lacks a permission in that place, or because the target sits too high. The most common cause is role order: a bot can only assign roles that sit below its own highest role, and can only kick, ban, time out or rename members whose highest role is below the bot's highest role. Administrator does not skip that check. The second cause is a channel or category overwrite that takes away a permission the bot's server role gives it. 50001 Missing Access usually means the bot cannot view the channel, or is not in that server. Log the method and URL of the failed request, drag the bot's role above the roles it manages in Server Settings > Roles, and check the channel's Permissions tab for the bot's role.
What 50013 and 50001 mean
Both are JSON error codes from Discord's API, sent with HTTP status 403 Forbidden. Discord describes 50013 as "You lack permissions to perform that action" and 50001 as "Missing access". Your library shows them like this:
| Library | 50013 | 50001 |
|---|---|---|
| discord.js | DiscordAPIError[50013]: Missing Permissions | DiscordAPIError[50001]: Missing Access |
| discord.py | 403 Forbidden (error code: 50013): Missing Permissions | 403 Forbidden (error code: 50001): Missing Access |
The discord.js guide draws the line: Missing Access means the bot cannot get to the thing at all, most often because it lacks View Channel in a text channel or Connect in a voice channel. Missing Permissions means it gets there but lacks the permission for the action, fails a role hierarchy check, or is timed out itself.
Step 1: Find the request that failed
The error name does not say what the bot was doing. discord.js puts that on the error object as method, url, status, code and rawError. A real log from a discord.js issue, shortened:
DiscordAPIError[50013]: Missing Permissions
at async GuildMemberRoleManager.add (...)
rawError: { message: 'Missing Permissions', code: 50013 },
code: 50013,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/guilds/1121829832423129160/members/758681611251744788/roles/1181943769789108255'
}
PUT .../members/{user}/roles/{role} is Add Guild Member Role, so this bot was handing out a role. A discord.js contributor replied: "The role you're trying to add is probably higher then the highest role of the bot." Match your URL against this table:
| Request in the error | What the bot tried | What Discord checks |
|---|---|---|
PUT or DELETE /guilds/{guild}/members/{user}/roles/{role} | Add or remove a role | Manage Roles, role below the bot's highest role, not a managed role |
PATCH /guilds/{guild}/members/{user} | Nickname, roles, timeout or voice move | Manage Nicknames, Manage Roles, Moderate Members or Move Members, plus role order for a nickname, role or timeout |
DELETE /guilds/{guild}/members/{user} | Kick | Kick Members, member below the bot |
PUT /guilds/{guild}/bans/{user} | Ban | Ban Members, member below the bot |
POST /channels/{channel}/messages | Send a message | View Channel (otherwise 50001), Send Messages, Read Message History for a reply |
PUT /channels/{channel}/messages/{message}/reactions/{emoji}/@me | React | Read Message History, plus Add Reactions for an emoji nobody used yet |
PUT /channels/{channel}/permissions/{id} | Change a channel overwrite | Manage Roles, and only permissions the bot has itself |
PUT /applications/{app}/guilds/{guild}/commands | Deploy guild commands | The app is installed in that server |
The rules come from Discord's Create Message, Create Reaction and Modify Guild Member docs. So message.reply() can fail where channel.send() works: a reply needs Read Message History.
Catch these errors: in that issue the uncaught error ended the whole process. This discord.js wrapper logs what failed and keeps going:
const { DiscordAPIError, RESTJSONErrorCodes } = require('discord.js');
const PERMISSION_ERRORS = new Set([
RESTJSONErrorCodes.MissingPermissions, // 50013
RESTJSONErrorCodes.MissingAccess, // 50001
]);
async function tryDiscord(label, action) {
try {
return await action();
} catch (err) {
if (err instanceof DiscordAPIError && PERMISSION_ERRORS.has(err.code)) {
console.warn(`${label}: ${err.code} ${err.message} on ${err.method} ${err.url}`);
return null;
}
throw err;
}
}
// Example: an auto-role on join (needs the Server Members intent). MEMBER_ROLE_ID is your own role ID.
client.on('guildMemberAdd', async (member) => {
const role = member.guild.roles.cache.get(MEMBER_ROLE_ID);
if (!role) return;
await tryDiscord(`add role ${role.id} to ${member.id}`, () => member.roles.add(role));
});
In discord.py the same error is a discord.Forbidden:
import discord
async def give_role(member: discord.Member, role: discord.Role) -> None:
try:
await member.add_roles(role, reason="Verified")
except discord.Forbidden as e:
# 403, then 50013 or 50001, then Discord's message
print(e.status, e.code, e.text, e.response.method, e.response.url)
On our Discord bot hosting the paid plans restart a bot automatically after a crash, but a restart does not fix a permission error: the same request fails again until the role or channel is fixed.
Step 2: Fix the role order (why your Discord bot won't assign roles)
Discord's permission hierarchy says a bot can only grant, edit and sort roles lower than its own highest role, can only grant permissions it has itself, and can only kick, ban and edit nicknames for users whose highest role is lower than the bot's highest role.
Lower means strictly lower. Discord's Roles and Permissions article says members with Manage Roles "cannot make any changes to roles that are equal to or positioned above their own role level". The discord.js guide adds that Administrator does not skip any hierarchy check: it lets a bot ignore channel overwrites, not role order.
To fix it in Discord:
- Click the server name in the top left and open Server Settings > Roles. To move roles you need Manage Roles and a role above the ones you move, or you need to be the owner.
- Find the bot's role, usually named after the bot. A role you made for the bot yourself started at the bottom of the list, just above @everyone.
- Drag the bot's role above every role it should hand out, and above the highest role of everyone it should kick, ban, time out or rename. Save.
- Run the command again. No restart is needed: Discord checks role positions when each request arrives.
Role order cannot fix these cases:
- The server owner. No bot can kick, ban, rename or time out the owner, and discord.js reports the owner as not
manageable. - Admins and timeouts. Discord's Modify Guild Member docs say a timeout "will throw a 403 error if the user has the ADMINISTRATOR permission or is the owner of the guild". A bot above an admin can still kick or ban that admin.
- Managed roles. Bot roles, the Booster role and integration roles cannot be added or removed by a bot. discord.js reports them as not
editable, and discord.py'sRole.is_assignable()returnsFalse. - The bot's own top role. It is not below itself, so the bot cannot hand it out.
Our auto-role and verification guide has join and reaction role code that hits this rule.
Step 3: Check channel and category overwrites
The bot's server role is only the starting point. Discord applies overwrites in a fixed order: server permissions, then the channel's @everyone overwrite, then role overwrites (denies, then allows), then an overwrite for that one member.
What that order means for your bot:
- Role allows beat role denies. If one of the bot's roles denies View Channel in a channel and another allows it, the bot can view it, "regardless of the role positions".
- A deny on the bot's role or on the bot itself beats its server permissions. Send Messages server wide does not help in a channel that denies it for the bot's role.
- Private channels. Discord's Roles and Permissions article says making a channel private removes View Channel from @everyone. A bot without its own allow there gets 50001.
- Categories. A channel synced to its category follows the category. A channel that is no longer synced keeps its own overwrites (Permission Syncing), so check both.
- Threads. Send Messages does not carry over into threads. A bot needs Send Messages in Threads, and View Channel on the parent channel.
- Implicit denies. Without View Channel, every other permission in the channel is ignored, and without Send Messages, Attach Files and Embed Links are ignored too (Implicit Permissions).
- A timed out bot. Timed out members "temporarily lose all permissions except VIEW_CHANNEL and READ_MESSAGE_HISTORY" (Discord docs). If a moderator timed out your bot, its actions fail until the timeout ends.
To fix a channel, right-click it and pick Edit Channel > Permissions. Add the bot's role with Add members or roles, then set View Channel, Send Messages, Embed Links and Read Message History to the green check. Do the same on the category when the channel is synced. Administrator would skip all overwrites, but it hands the bot every other permission too.
Step 4: Work through Missing Access (50001)
When the code is 50001, check these, from the discord.js guide and Discord's docs:
- Text channel: the bot lacks View Channel, often through a private channel or a category deny.
- Voice channel: the bot lacks Connect.
- The bot left the server, or your config holds the ID of a server or channel it is no longer in. The Hermes AI agent logged
403 Forbidden (error code: 50001): Missing Accessin a GitHub issue after its bot was removed from a server or lost its permissions. - Deploying guild commands. The app must be installed in that server. Discord's OAuth2 docs say
applications.commandsis "included by default with thebotscope". Check the guild ID in your deploy script first; for a bot added long ago, invite it again withscope=bot+applications.commands.
Check permissions in code before Discord says no
A check before the request lets you tell the user what to change. discord.js 14.28.0 has the pieces:
const { PermissionFlagsBits } = require('discord.js');
// Returns why the bot cannot give this role, or null if it should work.
function roleProblem(role) {
const me = role.guild.members.me;
if (!me.permissions.has(PermissionFlagsBits.ManageRoles)) return 'the bot has no Manage Roles permission';
if (role.managed) return `${role.name} is managed by an integration`;
if (me.roles.highest.comparePositionTo(role) <= 0) {
return `move the bot's role (${me.roles.highest.name}) above ${role.name}`;
}
return null;
}
// Lists the permissions the bot lacks in a channel, such as [ 'ViewChannel' ].
// discord.js does not apply implicit permissions for you, so always include ViewChannel.
function channelProblems(channel) {
const needed = [
PermissionFlagsBits.ViewChannel,
PermissionFlagsBits.SendMessages,
PermissionFlagsBits.EmbedLinks,
];
return channel.permissionsFor(channel.guild.members.me).missing(needed);
}
For moderation, member.kickable, member.bannable and member.moderatable (timeouts) combine the permission with the hierarchy check. In discord.py, role.is_assignable() covers position and managed roles, and channel.permissions_for(guild.me) gives the bot's permissions in a channel:
import discord
def channel_problems(channel: discord.abc.GuildChannel) -> list[str]:
perms = channel.permissions_for(channel.guild.me)
needed = ("view_channel", "send_messages", "embed_links")
return [name for name in needed if not getattr(perms, name)]
Since 30 October 2026 you can also ask Discord for its own calculation. Get Channel Member Permissions "returns the member's computed permissions in the channel, including their roles and member-specific overwrites":
const { PermissionsBitField } = require('discord.js');
async function botPermissionsIn(client, channelId) {
const { permissions } = await client.rest.get(
`/channels/${channelId}/permissions/member/${client.user.id}`,
);
return new PermissionsBitField(BigInt(permissions)).toArray();
}
The endpoint itself requires View Channel, plus Connect for voice and stage channels, so if this call is refused, start with View Channel.
Intents, invite links and 2FA are separate problems
- Gateway intents never cause 50013 or 50001. A privileged intent you did not enable closes the connection with close code 4014, "Disallowed intent(s)", and without the Message Content intent most messages reach your bot with an empty
contentfield (Gateway docs). See our intents guide. - The invite link only sets the starting point. The
permissionsnumber in the bot authorization URL decides what the bot gets when it joins. Admins can change the bot's role later, so check the role as it is now. - Two-factor authentication. In a server that requires 2FA for moderation, elevated permissions such as Kick Members, Ban Members, Manage Roles and Manage Messages only work for a bot whose owner account has 2FA on. Look for code 60003, "Two factor is required for this operation", rather than 50013.
What changes on 16 November 2026
From Monday 16 November, channels your bot cannot view stop showing their real details. Discord's change log says this "becomes mandatory for all bots on November 16, 2026", unchanged when we checked on 3 November. Over the Gateway such channels arrive named ___hidden___ with the CHANNEL_OBFUSCATED flag, and GET /guilds/{guild.id}/channels leaves them out.
The docs describe no change to 50001 or 50013 themselves, and the fix stays View Channel for the bot's role. But a log line that prints the channel name will say #___hidden___, so log channel IDs. For setup commands, discord.js 14.28.0 adds appPermissions to a channel picked in a command option, so you can refuse a channel the bot cannot use before saving it. Our channel obfuscation guide has the details, and our discord.js v14 guide shows how to check your version.
Checklist for bot owners
- Read
methodandurlon the error to see which action failed. - The bot's highest role sits above every role it assigns and every member it moderates.
- The target is not the owner, an admin you want to time out, or a managed role.
- The bot's role has the permission itself, such as Manage Roles.
- Channel and category overwrites allow View Channel, Send Messages and Read Message History (and Send Messages in Threads) for the bot's role.
- The bot is not timed out, is still in the server, and your IDs are right.
- Every Discord call sits in a try and catch.
FAQ
What does DiscordAPIError[50013]: Missing Permissions mean?
Discord refused the request because the bot lacks a permission where it acted, or because the role or member it acted on is at or above the bot's highest role. The url on the error shows which endpoint failed.
Why won't my Discord bot assign roles, even with Administrator? Role order. A bot can only grant roles below its own highest role, and Administrator skips channel overwrites but not the hierarchy. Move the bot's role above the role it hands out. Managed roles, such as the Booster role, cannot be assigned.
What is the difference between 50013 Missing Permissions and 50001 Missing Access? 50001 means the bot cannot reach the resource: no View Channel, no Connect, or not in the server. 50013 means it can reach it but lacks the permission or fails a hierarchy check. Both are HTTP 403.
Why does my bot get Missing Access when it deploys slash commands?
Usually the guild ID in your deploy script points to a server the app is not installed in. For a bot invited long ago, invite it again with scope=bot+applications.commands.
My AI agent's Discord bot says Missing Permissions. Is that a different problem? No. Agents such as OpenClaw connect through a normal bot that you invite to your server, as its Discord setup docs describe, so the same role order and channel overwrites apply. Fix the bot's role and the channel permissions.
Related guides: 'The Application Did Not Respond': error 10062 | Discord bot error handling and logging | Discord channel obfuscation
Sources
All opened on 3 November 2026:
- Discord developer docs: Permissions (permission table, hierarchy, overwrites, implicit permissions, channel visibility, threads, permission syncing, timed out members), JSON error codes and Gateway close codes, OAuth2 scopes, bot authorization and 2FA requirement, Modify Guild Member and Add Guild Member Role, Create Message and Create Reaction, Edit Channel Permissions and Get Channel Member Permissions, Gateway intents, change log
- Discord support: Discord Roles and Permissions, Channel Permissions Settings 101
- discord.js: guide, Permissions (extended); source at 14.28.0: GuildMember.js, Role.js, GuildChannel.js, DiscordAPIError.ts; issue 10040; discord-api-types RESTJSONErrorCodes
- discord.py 2.7.1: errors.py, role.py, member.py
- Hermes Agent issue 21188 and OpenClaw Discord docs