DiscordAPIError[50001]: Missing Access
I am trying to deploy-commands.js but its said
Started refreshing 4 application (/) commands.
There is no log Successfully reloaded 4 application (/)commands
instead terminal sending this
DiscordAPIError[50001]: Missing Access
at handleErrors (C:\Users\Administrator\Documents\BloxAssist\node_modules@discordjs\rest\dist\index.js:727:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async SequentialHandler.runRequest (C:\Users\Administrator\Documents\Blox at async SequentialHandler.queueRequest (C:\Users\Administrator\Documents\BloxAssist\node_modules@discordjs\rest\dist\index.js:959:14)
at async _REST.request (C:\Users\Administrator\Documents\BloxAssist\node_modules@discordjs\rest\dist\index.js:1272:22)
at async C:\Users\Administrator\Documents\BloxAssist\src\clientlogin\deploy-commands.js:36:16 {
requestBody: {
files: undefined,
json: [ [Object], [Object], [Object], [Object] ]
},
rawError: { message: 'Missing Access', code: 50001 },
code: 50001,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1342860625017049140/guilds/1342327226804479397/commands'
}
10 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPconst { REST, Routes } = require('discord.js'); const { clientId, guildId, token } = require('./config.json'); const fs = require('node:fs'); const path = require('node:path'); const commands = []; // Grab all the command folders from the commands directory you created earlier const foldersPath = path.join(__dirname, 'commands'); const commandFolders = fs.readdirSync(foldersPath); for (const folder of commandFolders) { // Grab all the command files from the commands directory you created earlier const commandsPath = path.join(foldersPath, folder); const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')); // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment for (const file of commandFiles) { const filePath = path.join(commandsPath, file); const command = require(filePath); if ('data' in command && 'execute' in command) { commands.push(command.data.toJSON()); } else { console.log([WARNING] The command at ${filePath} is missing a required "data" or "execute" property.
); } } } // Construct and prepare an instance of the REST module const rest = new REST().setToken(token); // and deploy your commands! (async () => { try { console.log(Started refreshing ${commands.length} application (/) commands.
); // The put method is used to fully refresh all commands in the guild with the current set const data = await rest.put( Routes.applicationGuildCommands(clientId, guildId), { body: commands }, ); console.log(Successfully reloaded ${data.length} application (/) commands.
); } catch (error) { // And of course, make sure you catch and log any errors! console.error(error); } })();
your bot doesn't have permissions to create commands on that guild, in other words its missing the applications.commands scope
I do

re-invite the bot then and make sure the clientId and guildId matches the proper bot and server
I dont know why its still same

I keep re invite the bot but its still same problem


are you sure the guild id is correct
and the correct client id
yes im pretty sure
FINALLY ITS WORK