unknown interaction error

Is there a reason why I keep getting random unknown interaction errors? [2023-04-04 00:16:12] [ERROR] Encountered error on chat input command "translate" at path "/workspace/src/commands/basic/translate.js" DiscordAPIError: Unknown interaction [biit] [2023-04-04 00:16:12] at RequestHandler.execute (/workspace/node_modules/discord.js/src/rest/RequestHandler.js:350:13) [biit] [2023-04-04 00:16:12] at processTicksAndRejections (node:internal/process/task_queues:96:5) [biit] [2023-04-04 00:16:12] at async RequestHandler.push (/workspace/node_modules/discord.js/src/rest/RequestHandler.js:51:14) [biit] [2023-04-04 00:16:12] at async CommandInteraction.reply (/workspace/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:103:5) [biit] [2023-04-04 00:16:12] at async TranslateCommand.chatInputRun (/workspace/src/commands/basic/translate.js:59:12) [biit] [2023-04-04 00:16:12] at async /workspace/node_modules/@sapphire/framework/dist/listeners/application-commands/chat-input/CoreChatInputCommandAccepted.js:17:28 [biit] [2023-04-04 00:16:12] at async Object.fromAsync (/workspace/node_modules/@sapphire/result/dist/index.js:615:22) [biit] [2023-04-04 00:16:12] at async CoreListener.run (/workspace/node_modules/@sapphire/framework/dist/listeners/application-commands/chat-input/CoreChatInputCommandAccepted.js:14:24) [biit] [2023-04-04 00:16:12] at async Object.fromAsync (/workspace/node_modules/@sapphire/result/dist/index.js:615:22) [biit] [2023-04-04 00:16:12] at async CoreListener._run (/workspace/node_modules/@sapphire/framework/dist/lib/structures/Listener.js:93:24) { [biit] [2023-04-04 00:16:12] method: 'post', [biit] [2023-04-04 00:16:12] path: '/interactions/1092603447557234769/aW50ZXJhY3Rpb246MTA5MjYwMzQ0NzU1NzIzNDc2OTpxa1pITUFVcEFuNm03ZFhpZmZNS3lOR0RxUUZaZGdmZmVHVXU0U05KRzZiWVhoazRDUWlNRkdOeDhSRFFTRlNVa24zT3RJY0szeWt1Vml1TzhKRnI4anQ3TjE1UGp2N2ZCblkwSWF0UmlBSXlTNzFjM041cUZvRzlRVTBiZFV1Sw/callback', [biit] [2023-04-04 00:16:12] code: 10062, [biit] [2023-04-04 00:16:12] httpStatus: 404, [biit] [2023-04-04 00:16:12] requestData: { json: { type: 4, data: [Object] }, files: [] } [biit] [2023-04-04 00:16:12] }
Solution:
Then add interaction.deferReply() before the async function and then reply with interaction.editReply(); Normal commands only can respond in 3 seconds and with deferred 15 minutes...
Jump to solution
7 Replies
Jesse
Jesse15mo ago
the command works sometimes, but other times it throws this error
Sawako
Sawako15mo ago
I imagine that the command is async, right?
Jesse
Jesse15mo ago
yes async chatInputRun(interaction){} when i tested the bot running locally it seems to function fine, but once i pushed to the hosting it is having some issues
Solution
Sawako
Sawako15mo ago
Then add interaction.deferReply() before the async function and then reply with interaction.editReply(); Normal commands only can respond in 3 seconds and with deferred 15 minutes
Jesse
Jesse15mo ago
okay i will try that rq
Syntox
Syntox15mo ago
Had the same issue. I accidentally still had the bot running in an old terminal, which lead to one of the instances respond to the command just fine and the other one responding to an already finished command.
Jesse
Jesse15mo ago
last night i encountered an even weirder problem. the bot has been running just fine, then suddenly all the commands were deregistered and i had to reboot the bot to fix it