modal submit unknown interaction

await interaction.showModal(modal); //ButtonInteraction

const filter = (i) =>
i.user.id === interaction.user.id &&
i.customId === modal.data.custom_id;
const modal_submit = await interaction
.awaitModalSubmit({ filter, time: 300_000 })
.catch(() => null);
if (!modal_submit) return;
await modal_submit.deferReply({ ephemeral: true });
await interaction.showModal(modal); //ButtonInteraction

const filter = (i) =>
i.user.id === interaction.user.id &&
i.customId === modal.data.custom_id;
const modal_submit = await interaction
.awaitModalSubmit({ filter, time: 300_000 })
.catch(() => null);
if (!modal_submit) return;
await modal_submit.deferReply({ ephemeral: true });
I get a DiscordAPIError[10062]: Unknown interaction at the last line. Why? It is possible to defer modal submissions, is it? The filter should also account for multiple users submitting modals with the same custom_id, right? So what's the problem? The above code is called through an interactionCreate listener.
3 Replies
d.js toolkit
d.js toolkit10mo 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
3D_MAMA
3D_MAMAOP10mo ago
full trace:
DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\BlaBla\OneDrive\.shared_files\github\project\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\BlaBla\OneDrive\.shared_files\github\project\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (C:\Users\BlaBla\OneDrive\.shared_files\github\project\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ModalSubmitInteraction.deferReply (C:\Users\BlaBla\OneDrive\.shared_files\github\project\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:69:5)
at async Object.b_authorize_callback [as execute] (C:\Users\BlaBla\OneDrive\.shared_files\github\project\commands\login.js:231:5)
at async handleMessageComponent (C:\Users\BlaBla\OneDrive\.shared_files\github\project\events\interactionCreate.js:79:9)
at async Object.onInteractionCreate [as execute] (C:\Users\BlaBla\OneDrive\.shared_files\github\project\events\interactionCreate.js:98:9) {
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/1206579961838829568/aW50ZXJhY3Rpb246MTIwNjU3OTk2MTgzODgyOTU2ODpCcWV1Vm16cnlJT3ZxWllkZkJsU0NxNkVGYmE0aGFWNTJDdk9JSE5OVVZybVkzR2RaOU9qUUl3NTgyN0tMYzF1dTNwaG5oN0YxZkNvU3R6ZTN0bkxJemNob3pKNG5TbGViNVVpU3VvbDNuMEZmUDJweTFGQmx0Rg/callback'
}
DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\BlaBla\OneDrive\.shared_files\github\project\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\BlaBla\OneDrive\.shared_files\github\project\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (C:\Users\BlaBla\OneDrive\.shared_files\github\project\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ModalSubmitInteraction.deferReply (C:\Users\BlaBla\OneDrive\.shared_files\github\project\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:69:5)
at async Object.b_authorize_callback [as execute] (C:\Users\BlaBla\OneDrive\.shared_files\github\project\commands\login.js:231:5)
at async handleMessageComponent (C:\Users\BlaBla\OneDrive\.shared_files\github\project\events\interactionCreate.js:79:9)
at async Object.onInteractionCreate [as execute] (C:\Users\BlaBla\OneDrive\.shared_files\github\project\events\interactionCreate.js:98:9) {
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/1206579961838829568/aW50ZXJhY3Rpb246MTIwNjU3OTk2MTgzODgyOTU2ODpCcWV1Vm16cnlJT3ZxWllkZkJsU0NxNkVGYmE0aGFWNTJDdk9JSE5OVVZybVkzR2RaOU9qUUl3NTgyN0tMYzF1dTNwaG5oN0YxZkNvU3R6ZTN0bkxJemNob3pKNG5TbGViNVVpU3VvbDNuMEZmUDJweTFGQmx0Rg/callback'
}
Oh I think I got it. It's not the command handling that causes the error but the automatic error handling.
d.js docs
d.js docs10mo 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
Want results from more Discord servers?
Add your server