Error Code I can't seem to figure out
DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\mattw\OneDrive\Desktop\super\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\mattw\OneDrive\Desktop\super\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (C:\Users\mattw\OneDrive\Desktop\super\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async AutocompleteInteraction.respond (C:\Users\mattw\OneDrive\Desktop\super\node_modules\discord.js\src\structures\AutocompleteInteraction.js:86:5)
at async clanAutocomplete (C:\Users\mattw\OneDrive\Desktop\super\src\framework\functions\functions.js:376:5)
at async Object.autocomplete (C:\Users\mattw\OneDrive\Desktop\super\src\modules\clans\slashCommands\clans.js:244:21)
at async module.exports (C:\Users\mattw\OneDrive\Desktop\super\src\framework\events\interactionCreate.js:31:13) {
requestBody: { files: undefined, json: { type: 8, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1202823522397978674/aW50ZXJhY3Rpb246MTIwMjgyMzUyMjM5Nzk3ODY3NDo0eWd6dlAwQ1hqbEEwWDF2S2R2Rk5zREtxMmVTRmZQbVN5Rkk2Y0t6SFRmMWhhNDhhS2NwbjRmM3JWQmt3SFFjMkM3bVpwMmlZNUVGTENUb0s5TWVxVVQyUGdXVURDUGRSWkZubnRsODc5MVpsclRITHh6YWJtdk80Z2R4ZENZSA/callback'
}
DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\mattw\OneDrive\Desktop\super\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\mattw\OneDrive\Desktop\super\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (C:\Users\mattw\OneDrive\Desktop\super\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async AutocompleteInteraction.respond (C:\Users\mattw\OneDrive\Desktop\super\node_modules\discord.js\src\structures\AutocompleteInteraction.js:86:5)
at async clanAutocomplete (C:\Users\mattw\OneDrive\Desktop\super\src\framework\functions\functions.js:376:5)
at async Object.autocomplete (C:\Users\mattw\OneDrive\Desktop\super\src\modules\clans\slashCommands\clans.js:244:21)
at async module.exports (C:\Users\mattw\OneDrive\Desktop\super\src\framework\events\interactionCreate.js:31:13) {
requestBody: { files: undefined, json: { type: 8, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1202823522397978674/aW50ZXJhY3Rpb246MTIwMjgyMzUyMjM5Nzk3ODY3NDo0eWd6dlAwQ1hqbEEwWDF2S2R2Rk5zREtxMmVTRmZQbVN5Rkk2Y0t6SFRmMWhhNDhhS2NwbjRmM3JWQmt3SFFjMkM3bVpwMmlZNUVGTENUb0s5TWVxVVQyUGdXVURDUGRSWkZubnRsODc5MVpsclRITHh6YWJtdk80Z2R4ZENZSA/callback'
}
4 Replies
- 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! async autocomplete(interaction) {
try {
const optionName = interaction.options._hoistedOptions.find(option => option.focused === true).name;
console.log(optionName)
switch (optionName) {
case "branch":
await branchAutocomplete(interaction);
break;
case "clan":
await clanAutocomplete(interaction)
break;
default:
console.log(`Unrecognized option ${interaction.options._hoistedOptions} in subcommand ${interaction.options._subcommand}`);
break;
}
} catch (error) {
console.log(error);
}
}
async autocomplete(interaction) {
try {
const optionName = interaction.options._hoistedOptions.find(option => option.focused === true).name;
console.log(optionName)
switch (optionName) {
case "branch":
await branchAutocomplete(interaction);
break;
case "clan":
await clanAutocomplete(interaction)
break;
default:
console.log(`Unrecognized option ${interaction.options._hoistedOptions} in subcommand ${interaction.options._subcommand}`);
break;
}
} catch (error) {
console.log(error);
}
}
async function clanAutocomplete(interaction) {
// Get the full option list
const { client: { clans} } = interaction;
// Retrieve the current search input
const focusedValue = interaction.options.getFocused();
// Filter the option list
const filtered = clans.filter(clan => clan.name.startsWith(focusedValue));
// Return the filtered list
await interaction.respond(
filtered.map(choice => ({name: choice.name, value: choice.role })),
)
}
async function clanAutocomplete(interaction) {
// Get the full option list
const { client: { clans} } = interaction;
// Retrieve the current search input
const focusedValue = interaction.options.getFocused();
// Filter the option list
const filtered = clans.filter(clan => clan.name.startsWith(focusedValue));
// Return the filtered list
await interaction.respond(
filtered.map(choice => ({name: choice.name, value: choice.role })),
)
}
[
{
name: 'gladiators legion',
role: '1706830752709',
branch: undefined,
member: '411886883983982593',
invisible: false
}
]
[
{
name: 'gladiators legion',
role: '1706830752709',
branch: undefined,
member: '411886883983982593',
invisible: false
}
]
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 responsesIs that was is causing the error?
it's a collection
and it sometimes shows up and othertimes a cached version of it shows up from before I cleared the db
othertimes I get an error that says the interaction was already responded without anything happening or being touched in fact when that error comes I'm still putting inputs into the slash command and it was never even entered
anyone got an idea?
Here's another one
the last line is line 88 where it says the unknown interaction is coming from, and yet it still posts the embed anyway??
DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\mattw\OneDrive\Desktop\super\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\mattw\OneDrive\Desktop\super\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (C:\Users\mattw\OneDrive\Desktop\super\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ChatInputCommandInteraction.reply (C:\Users\mattw\OneDrive\Desktop\super\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5)
at async Object.execute (C:\Users\mattw\OneDrive\Desktop\super\src\modules\clans\slashCommands\clans.js:88:32)
at async module.exports (C:\Users\mattw\OneDrive\Desktop\super\src\framework\events\interactionCreate.js:10:17) {
requestBody: { files: [], json: { type: 4, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1202987468937498655/aW50ZXJhY3Rpb246MTIwMjk4NzQ2ODkzNzQ5ODY1NTpHMlJWM01uQ3NPckgzVmtCV3pxekNISnExbkFjYm42clBjNmh6YWw1eDE1ZEY5WHpmUDJhZTl4OE94ZHVHeGY5RGpXVzlzNGViTzhjTDJOZExpUFJhbDBPaXdxdlMzM2MyOVhmZWI1cHBSRnFGOUJ1SmZRY1J6TnRhRUg5OFNxNg/callback'
}
DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\mattw\OneDrive\Desktop\super\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\mattw\OneDrive\Desktop\super\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (C:\Users\mattw\OneDrive\Desktop\super\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ChatInputCommandInteraction.reply (C:\Users\mattw\OneDrive\Desktop\super\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5)
at async Object.execute (C:\Users\mattw\OneDrive\Desktop\super\src\modules\clans\slashCommands\clans.js:88:32)
at async module.exports (C:\Users\mattw\OneDrive\Desktop\super\src\framework\events\interactionCreate.js:10:17) {
requestBody: { files: [], json: { type: 4, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1202987468937498655/aW50ZXJhY3Rpb246MTIwMjk4NzQ2ODkzNzQ5ODY1NTpHMlJWM01uQ3NPckgzVmtCV3pxekNISnExbkFjYm42clBjNmh6YWw1eDE1ZEY5WHpmUDJhZTl4OE94ZHVHeGY5RGpXVzlzNGViTzhjTDJOZExpUFJhbDBPaXdxdlMzM2MyOVhmZWI1cHBSRnFGOUJ1SmZRY1J6TnRhRUg5OFNxNg/callback'
}
case 'add': {
// Logic for add command
const name = interaction.options.getString('name');
const role = interaction.options.getRole('role') || undefined;
const branch = interaction.options.getString('branch');
if (!name || !branch) {
return Reply(interaction, 'Error: Missing required parameters.', true);
}
const embedOptions = {
title: `Gilded Phoenix Clan Management`,
fields: [
{name: `Clan Name`,value: name.toString(), inline:true},
{name: `Branch`,value: branch.toString(), inline:true},
{name: 'Role', value: role === undefined ? 'undefined' : role.toString(), inline: true}
],
color: '#3b561d',
footer: `gilded Phoenix Clan Management`
}
const embed = createEmbed(embedOptions);
const buttons = ConfirmationButtons('clan_add_yes','clan_add_no')
const msg = await interaction.reply({embeds: [embed], ephemeral: true, components: [buttons], fetchReply: true});
case 'add': {
// Logic for add command
const name = interaction.options.getString('name');
const role = interaction.options.getRole('role') || undefined;
const branch = interaction.options.getString('branch');
if (!name || !branch) {
return Reply(interaction, 'Error: Missing required parameters.', true);
}
const embedOptions = {
title: `Gilded Phoenix Clan Management`,
fields: [
{name: `Clan Name`,value: name.toString(), inline:true},
{name: `Branch`,value: branch.toString(), inline:true},
{name: 'Role', value: role === undefined ? 'undefined' : role.toString(), inline: true}
],
color: '#3b561d',
footer: `gilded Phoenix Clan Management`
}
const embed = createEmbed(embedOptions);
const buttons = ConfirmationButtons('clan_add_yes','clan_add_no')
const msg = await interaction.reply({embeds: [embed], ephemeral: true, components: [buttons], fetchReply: true});