Unknown Interaction

for some reason I keep getting this error when trying to run a command, this only happens sometimes.
DiscordAPIError: Unknown interaction
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async CommandInteraction.deferReply (/home/container/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:61:5)
at async module.exports (/home/container/src/events/interactionCreate.js:5:5) {
method: 'post',
path: '/interactions/1253563066042421249/aW50ZXJhY3Rpb246MTI1MzU2MzA2NjA0MjQyMTI0OTpKTlZsOVdWcUJLbFZ4T25wdG1iUzVTUUlDSUFRcjcxUk1wRXpJbmVXUTFseGdXTXhNRHBOOHJpTmo1eUNKMGs4Mkl4eWxBUURKUmZQc0pvcEN4OHVKaVk4WVFYRDlNaHhvV1o2QlNXUUZhQUFVU1hLTDNoUFlReTNzU0s0a0xoTg/callback',
code: 10062,
httpStatus: 404,
requestData: { json: { type: 5, data: [Object] }, files: [] }
}
DiscordAPIError: Unknown interaction
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async CommandInteraction.deferReply (/home/container/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:61:5)
at async module.exports (/home/container/src/events/interactionCreate.js:5:5) {
method: 'post',
path: '/interactions/1253563066042421249/aW50ZXJhY3Rpb246MTI1MzU2MzA2NjA0MjQyMTI0OTpKTlZsOVdWcUJLbFZ4T25wdG1iUzVTUUlDSUFRcjcxUk1wRXpJbmVXUTFseGdXTXhNRHBOOHJpTmo1eUNKMGs4Mkl4eWxBUURKUmZQc0pvcEN4OHVKaVk4WVFYRDlNaHhvV1o2QlNXUUZhQUFVU1hLTDNoUFlReTNzU0s0a0xoTg/callback',
code: 10062,
httpStatus: 404,
requestData: { json: { type: 5, data: [Object] }, files: [] }
}
22 Replies
d.js toolkit
d.js toolkit2mo ago
- 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 OP
d.js docs
d.js docs2mo ago
Common causes of DiscordAPIError[10062]: Unknown interaction: - Initial response took more than 3 seconds ➞ defer the response *. - Wrong interaction object inside a collector. - Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance) * Note: you cannot defer modal or autocomplete value responses
Amgelo
Amgelo2mo ago
^^ most likely the first
fauteen
fauteen2mo ago
every time i try to defer the response i get a interaction already replied error.
Amgelo
Amgelo2mo ago
after a defer you need to use editReply, not reply or update since the defer is a reply by itself
fauteen
fauteen2mo ago
Let me try that quickly. I used edit reply and got this error.
Error executing the /fish command: Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
at CommandInteraction.deferReply (/home/runner/System-Bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:59:46)
at Object.run (/home/runner/System-Bot/src/slashcommands/fish.js:37:25)
at module.exports (/home/runner/System-Bot/src/events/interactionCreate.js:55:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'INTERACTION_ALREADY_REPLIED'
}
Error executing the /fish command: Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
at CommandInteraction.deferReply (/home/runner/System-Bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:59:46)
at Object.run (/home/runner/System-Bot/src/slashcommands/fish.js:37:25)
at module.exports (/home/runner/System-Bot/src/events/interactionCreate.js:55:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'INTERACTION_ALREADY_REPLIED'
}
Amgelo
Amgelo2mo ago
can you show your fish.js
fauteen
fauteen2mo ago
sure lol its over the text limit so i will split it up to two messages
Amgelo
Amgelo2mo ago
no, upload it to pastebin
fauteen
fauteen2mo ago
sure
d.js docs
d.js docs2mo ago
To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.
fauteen
fauteen2mo ago
Pastebin
const { MessageEmbed } = require('discord.js');const fs = require('...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Amgelo
Amgelo2mo ago
well you probably replied or deferred somewhere else then
fauteen
fauteen2mo ago
is there a way where i can make it like as soon as the command is sent, it sends a loading message like dyno, then sends the command embed etc?
Amgelo
Amgelo2mo ago
I'm not sure about what dynos' loading message is do you have an image?
fauteen
fauteen2mo ago
yep let me get it wait
duck
duck2mo ago
(based on the stack trace from the original error, I'd guess it's in interactionCreate.js)
fauteen
fauteen2mo ago
mb i was getting confused with the dyno is thinking thing
Amgelo
Amgelo2mo ago
yeah that's just a defer
fauteen
fauteen2mo ago
i can show you my interactioncreate.js if you want
Amgelo
Amgelo2mo ago
if you want to defer "as soon as possible", you'd do it on your command handler ig right before you actually call the command but that creates even more problems, so I'd just recommend that you only defer when you need it
fauteen
fauteen2mo ago
sure thank you so much for your help i really appreciate it alot