Unknown Interaction error

10% of the time, when I'm running a command, I get the Unknown Interaction error for 1 or 2 minutes straight, and then it goes back to normal. I defer the reply at the top of every command (well inside the execute), I have a collector in only 1 of my commands and it does have the correct interaction object and I am the only one running the command so just 1 process is handling the same command (saying this cuz of the /tag thing). I'm guessing it has to do with my interactionCreate file. I asked for help in another discord js coding server and a mod there tried to help me fix it, but we couldn't so I'm posting it here.
15 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
Papalo007
Papalo0072mo ago
(I need nitro for bigger messages so ill send the error in 2 seperate messxages) Example of error:
DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\okpap\Desktop\OM Dicerr v2.0\node_modules\@discordjs\rest\dist\index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\okpap\Desktop\OM Dicerr v2.0\node_modules\@discordjs\rest\dist\index.js:835:23)
at async _REST.request (C:\Users\okpap\Desktop\OM Dicerr v2.0\node_modules\@discordjs\rest\dist\index.js:1278:22)
at async ChatInputCommandInteraction.deferReply (C:\Users\okpap\Desktop\OM Dicerr v2.0\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:71:5)
at async Object.execute (C:\Users\okpap\Desktop\OM Dicerr v2.0\src\commands\moderation\warnings.js:57:5)
at async Object.execute (C:\Users\okpap\Desktop\OM Dicerr v2.0\src\events\client\interactionCreate.js:14:11) {
requestBody: { files: undefined, json: { type: 5, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1260540054879862805/aW50ZXJhY3Rpb246MTI2MDU0MDA1NDg3OTg2MjgwNTo0cG5STmlyd2xDR1VmMUduMWN1UDFBSXB4aXI3Ylg5dzVaaUFQN0lxZW9YcVBNWlJyczRjajJSNjFNNzRCV0k0NUNvazNTektiNHN6OXduelhXMG9MbjRoSUZTRzIzbEk4WlRmWmFaUlZsZndSZkVzZXhaaElMaWt5WG5vR3R6Tg/callback'
}
node:events:496
throw er; // Unhandled 'error' event
^
DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\okpap\Desktop\OM Dicerr v2.0\node_modules\@discordjs\rest\dist\index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\okpap\Desktop\OM Dicerr v2.0\node_modules\@discordjs\rest\dist\index.js:835:23)
at async _REST.request (C:\Users\okpap\Desktop\OM Dicerr v2.0\node_modules\@discordjs\rest\dist\index.js:1278:22)
at async ChatInputCommandInteraction.deferReply (C:\Users\okpap\Desktop\OM Dicerr v2.0\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:71:5)
at async Object.execute (C:\Users\okpap\Desktop\OM Dicerr v2.0\src\commands\moderation\warnings.js:57:5)
at async Object.execute (C:\Users\okpap\Desktop\OM Dicerr v2.0\src\events\client\interactionCreate.js:14:11) {
requestBody: { files: undefined, json: { type: 5, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1260540054879862805/aW50ZXJhY3Rpb246MTI2MDU0MDA1NDg3OTg2MjgwNTo0cG5STmlyd2xDR1VmMUduMWN1UDFBSXB4aXI3Ylg5dzVaaUFQN0lxZW9YcVBNWlJyczRjajJSNjFNNzRCV0k0NUNvazNTektiNHN6OXduelhXMG9MbjRoSUZTRzIzbEk4WlRmWmFaUlZsZndSZkVzZXhaaElMaWt5WG5vR3R6Tg/callback'
}
node:events:496
throw er; // Unhandled 'error' event
^
Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
at ChatInputCommandInteraction.followUp (C:\Users\okpap\Desktop\OM Dicerr v2.0\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:187:64)
at Object.execute (C:\Users\okpap\Desktop\OM Dicerr v2.0\src\events\client\interactionCreate.js:19:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:401:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
code: 'InteractionNotReplied'
}

Node.js v20.12.2
[nodemon] app crashed - waiting for file changes before starting...
Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
at ChatInputCommandInteraction.followUp (C:\Users\okpap\Desktop\OM Dicerr v2.0\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:187:64)
at Object.execute (C:\Users\okpap\Desktop\OM Dicerr v2.0\src\events\client\interactionCreate.js:19:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:401:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
code: 'InteractionNotReplied'
}

Node.js v20.12.2
[nodemon] app crashed - waiting for file changes before starting...
here's my interactionCreate file: https://pastebin.com/WGUXkpZX
treble/luna
treble/luna2mo ago
line 18 returns a promise, thats one thing
Papalo007
Papalo0072mo ago
btw for the error, line 57 on warnings.js says await interaction.deferReply() on interactinCreate? oh right fetch I just add an await inside the brackets right?
treble/luna
treble/luna2mo ago
define it beforehand as for your unknown interaction, might be a host issue
Papalo007
Papalo0072mo ago
i just run it in vsc console so like
const interactionReply = await interaction.fetchReply()
if (interactionReply) {
const interactionReply = await interaction.fetchReply()
if (interactionReply) {
treble/luna
treble/luna2mo ago
Basically Not too sure if it rejects if there is no reply though
Papalo007
Papalo0072mo ago
so ur saying if it's false we don't know if the promise is rejected or there just isnt an interaction? shouldnt the await solve that?
d.js docs
d.js docs2mo ago
:property: ChatInputCommandInteraction#replied @14.15.3 Whether this interaction has already been replied to
treble/luna
treble/luna2mo ago
this also exists along with .deferred
Papalo007
Papalo0072mo ago
so interaction.replied checks if the interaction has been replied to and interaction.deferred checks if it has been deferred. makes sense even if i replace it with this, the unknown interaction error still happens
treble/luna
treble/luna2mo ago
Seems like a network issue then
Papalo007
Papalo0072mo ago
so if i get better network it's not gonna happen anymore? would make sense cuz currently im on vacation and from hotel wifi ig
treble/luna
treble/luna2mo ago
Probably yes
Papalo007
Papalo0072mo ago
ight thanks
Want results from more Discord servers?
Add your server