"Maximum number of application commands reached" but hitting the API returns an empty array?

I realized I was setting up global commands when developing my bot and have recently switched to using guild commands instead. However, when I run my bot locally I get an error message along these lines: Failed to overwrite global application commands DiscordAPIError[30032]: Maximum number of application commands reached (5). So I went through the process of deleting all the global application commands by hitting /applications/{application.id}/commands and copying down the ids of each command, then hitting /applications/{application.id}/commands/{command.id}. However, I'm still seeing the "Failed to overwrite global application commands" message when starting my bot. I double-checked /applications/{application.id}/commands and it's returning an empty array so I don't have any global application commands according to the API, and I know that I don't have 5 context menu commands (I counted them, it's 3 actually) so I'm not sure what exactly it's complaining about? I've attached guildIds options to each of my commands so I feel like that can't be the issue? I feel like I'm missing something but I'm not sure what it could be.
27 Replies
vladdy
vladdy•15mo ago
do you not get logs of which command is erroring? Or are you using BulkOverwrite?
secondubly
secondubly•15mo ago
it appears to be happening on startup with BulktOverwrite
vladdy
vladdy•15mo ago
Intriguing oh GLOBAL is erroring INTRIGUING
secondubly
secondubly•15mo ago
yeah, I'm not sure why? I can definitely tell I don't have any global application commands...the API even says so!
vladdy
vladdy•15mo ago
can you set your logLevel to debug OH SHIT hmm
secondubly
secondubly•15mo ago
I can post the log messages, just give me a minute or two 🙂
vladdy
vladdy•15mo ago
mhm I'm trying to see if maybe I fucked something up KEKW
secondubly
secondubly•15mo ago
2023-08-26 19:39:36 - INFO - logged in
2023-08-26 19:39:36 - INFO - ApplicationCommandRegistries: Initializing...
1.0.0
[+] Gateway
</> DEVELOPMENT MODE
2023-08-26 19:39:36 - INFO - ├─ Loaded 26 arguments.
2023-08-26 19:39:36 - INFO - ├─ Loaded 10 commands.
2023-08-26 19:39:36 - INFO - ├─ Loaded 0 interaction-handlers.
2023-08-26 19:39:36 - INFO - ├─ Loaded 30 listeners.
2023-08-26 19:39:36 - INFO - └─ Loaded 17 preconditions.
2023-08-26 19:39:36 - DEBUG - ApplicationCommandRegistries(BulkOverwrite) Overwriting global application commands, now at 22 commands
2023-08-26 19:39:36 - ERROR - ApplicationCommandRegistries(BulkOverwrite) Failed to overwrite global application commands DiscordAPIError[30032]: Maximum number of application commands reached (5).
2023-08-26 19:39:36 - ERROR - at SequentialHandler.runRequest (/home/tai/dev/FutabaBot/node_modules/@discordjs/rest/dist/index.js:667:15)
2023-08-26 19:39:36 - ERROR - at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-08-26 19:39:36 - ERROR - at async SequentialHandler.queueRequest (/home/tai/dev/FutabaBot/node_modules/@discordjs/rest/dist/index.js:464:14)
2023-08-26 19:39:36 - ERROR - at async REST.request (/home/tai/dev/FutabaBot/node_modules/@discordjs/rest/dist/index.js:910:22)
2023-08-26 19:39:36 - ERROR - at async ApplicationCommandManager.set (/home/tai/dev/FutabaBot/node_modules/discord.js/src/managers/ApplicationCommandManager.js:173:18)
2023-08-26 19:39:36 - ERROR - at async handleBulkOverwrite (/home/tai/dev/FutabaBot/node_modules/@sapphire/framework/dist/lib/utils/application-commands/ApplicationCommandRegistries.js:71:20)
2023-08-26 19:39:36 - ERROR - at async Object.handleRegistryAPICalls (/home/tai/dev/FutabaBot/node_modules/@sapphire/framework/dist/lib/utils/application-commands/ApplicationCommandRegistries.js:46:5)
2023-08-26 19:39:36 - ERROR - at async CoreEvent.run (/home/tai/dev/FutabaBot/node_modules/@sapphire/framework/dist/listeners/CoreReady.js:18:5)
2023-08-26 19:39:36 - ERROR - at async Object.fromAsync (/home/tai/dev/FutabaBot/node_modules/@sapphire/result/dist/index.js:615:22)
2023-08-26 19:39:36 - ERROR - at async CoreEvent._run (/home/tai/dev/FutabaBot/node_modules/@sapphire/framework/dist/lib/structures/Listener.js:48:22) {
2023-08-26 19:39:36 - ERROR - requestBody: [Object],
2023-08-26 19:39:36 - ERROR - rawError: [Object],
2023-08-26 19:39:36 - ERROR - code: 30032,
2023-08-26 19:39:36 - ERROR - status: 400,
2023-08-26 19:39:36 - ERROR - method: 'PUT',
2023-08-26 19:39:36 - ERROR - url: 'https://discord.com/api/v10/applications/1084157527563964556/commands'
2023-08-26 19:39:36 - ERROR - }
2023-08-26 19:39:36 - INFO - ApplicationCommandRegistries: Took 98ms to initialize.
2023-08-26 19:39:36 - INFO - logged in
2023-08-26 19:39:36 - INFO - ApplicationCommandRegistries: Initializing...
1.0.0
[+] Gateway
</> DEVELOPMENT MODE
2023-08-26 19:39:36 - INFO - ├─ Loaded 26 arguments.
2023-08-26 19:39:36 - INFO - ├─ Loaded 10 commands.
2023-08-26 19:39:36 - INFO - ├─ Loaded 0 interaction-handlers.
2023-08-26 19:39:36 - INFO - ├─ Loaded 30 listeners.
2023-08-26 19:39:36 - INFO - └─ Loaded 17 preconditions.
2023-08-26 19:39:36 - DEBUG - ApplicationCommandRegistries(BulkOverwrite) Overwriting global application commands, now at 22 commands
2023-08-26 19:39:36 - ERROR - ApplicationCommandRegistries(BulkOverwrite) Failed to overwrite global application commands DiscordAPIError[30032]: Maximum number of application commands reached (5).
2023-08-26 19:39:36 - ERROR - at SequentialHandler.runRequest (/home/tai/dev/FutabaBot/node_modules/@discordjs/rest/dist/index.js:667:15)
2023-08-26 19:39:36 - ERROR - at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-08-26 19:39:36 - ERROR - at async SequentialHandler.queueRequest (/home/tai/dev/FutabaBot/node_modules/@discordjs/rest/dist/index.js:464:14)
2023-08-26 19:39:36 - ERROR - at async REST.request (/home/tai/dev/FutabaBot/node_modules/@discordjs/rest/dist/index.js:910:22)
2023-08-26 19:39:36 - ERROR - at async ApplicationCommandManager.set (/home/tai/dev/FutabaBot/node_modules/discord.js/src/managers/ApplicationCommandManager.js:173:18)
2023-08-26 19:39:36 - ERROR - at async handleBulkOverwrite (/home/tai/dev/FutabaBot/node_modules/@sapphire/framework/dist/lib/utils/application-commands/ApplicationCommandRegistries.js:71:20)
2023-08-26 19:39:36 - ERROR - at async Object.handleRegistryAPICalls (/home/tai/dev/FutabaBot/node_modules/@sapphire/framework/dist/lib/utils/application-commands/ApplicationCommandRegistries.js:46:5)
2023-08-26 19:39:36 - ERROR - at async CoreEvent.run (/home/tai/dev/FutabaBot/node_modules/@sapphire/framework/dist/listeners/CoreReady.js:18:5)
2023-08-26 19:39:36 - ERROR - at async Object.fromAsync (/home/tai/dev/FutabaBot/node_modules/@sapphire/result/dist/index.js:615:22)
2023-08-26 19:39:36 - ERROR - at async CoreEvent._run (/home/tai/dev/FutabaBot/node_modules/@sapphire/framework/dist/lib/structures/Listener.js:48:22) {
2023-08-26 19:39:36 - ERROR - requestBody: [Object],
2023-08-26 19:39:36 - ERROR - rawError: [Object],
2023-08-26 19:39:36 - ERROR - code: 30032,
2023-08-26 19:39:36 - ERROR - status: 400,
2023-08-26 19:39:36 - ERROR - method: 'PUT',
2023-08-26 19:39:36 - ERROR - url: 'https://discord.com/api/v10/applications/1084157527563964556/commands'
2023-08-26 19:39:36 - ERROR - }
2023-08-26 19:39:36 - INFO - ApplicationCommandRegistries: Took 98ms to initialize.
wasn't sure if it was better to post that in a pastebin or something but butrShrug says it's at "22 commands" but I don't see how that could be the case?
vladdy
vladdy•15mo ago
Hmm, 10 commands but 22 app commands Check your registry calls
secondubly
secondubly•15mo ago
I have 3 calls to registerContextMenuCommand and 6 calls to registerApplicationCommands
vladdy
vladdy•15mo ago
6 calls to what
secondubly
secondubly•15mo ago
ah, let me clarify, I don't see any duplicate calls to registerChatInputCommand or registerContextMenuCommand - I have 6 total commands in the bot so far
vladdy
vladdy•15mo ago
you have 10 meguFace well 10 loaded commands
secondubly
secondubly•15mo ago
right, but I thought the limit for slash commands was 100? Or am I misremembering?
vladdy
vladdy•15mo ago
that it is Is this a public bot? as in OSS
secondubly
secondubly•15mo ago
hmm...let me check one thing really quick
vladdy
vladdy•15mo ago
I also want you to double confirm you saying registerApplicationCommands was wrong KEKW
secondubly
secondubly•15mo ago
yeah, I mistyped that, there's one call to registerApplicationCommands in each command file 😅
vladdy
vladdy•15mo ago
theres 1 WHAT call or reference you shouldn't call that method yourself if thats what you're saying rn
secondubly
secondubly•15mo ago
oh no, I'm not calling it myself; this is what I get for checking my phone after a nap. I mean to say that there's one registerApplicationCommands reference in each file.
vladdy
vladdy•15mo ago
o k thats a relief uh Circling back, is the code open source? Because your error shouldn't happen sweats
secondubly
secondubly•15mo ago
I do, I just wanna try rebuilding my typescript - I had a command file that I completely commented out and maybe by some weird happenstance, that's causing issues. but if that doesn't fix it, I'll link you to the repo
vladdy
vladdy•15mo ago
try a clean build rm -rf dist build
secondubly
secondubly•15mo ago
ha, yep, that fixed it I'm curious as to why commenting out a command would cause that error though.
vladdy
vladdy•15mo ago
its not impossible that the comment out wasn't the issue, but the built code had lingering commands that you might've deleted that never got rebuilt and welp they did things
secondubly
secondubly•15mo ago
fair enough AnisShrug either way, thanks for the help, I appreciate it!
vladdy
vladdy•15mo ago
any time :3
Want results from more Discord servers?
Add your server