Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DiscordAPIError[10062]: Unknown interaction (AutoComplete) #10345

Closed
Kuju29 opened this issue Jun 12, 2024 · 1 comment
Closed

DiscordAPIError[10062]: Unknown interaction (AutoComplete) #10345

Kuju29 opened this issue Jun 12, 2024 · 1 comment
Labels

Comments

@Kuju29
Copy link

Kuju29 commented Jun 12, 2024

Which package is this bug report for?

discord.js

Issue description

I encountered an issue where options do not work as they should in thread channels. The bot cannot use options the first time or during the initial period when opening thread channels, even though it has all necessary permissions and has been tagged. I have to repeatedly tag the bot or reopen options to get the bot working correctly without the 'Unknown interaction' error. Once the bot can select options, it does not encounter errors for that session. I think it's a bug because it used to work fine before without any problems.

Logs:

Error in autocomplete: DiscordAPIError[10062]: Unknown interaction
    at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:730:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async BurstHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:835:23)
    at async _REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1278:22)
    at async AutocompleteInteraction.respond (/home/container/node_modules/discord.js/src/structures/AutocompleteInteraction.js:86:5)
    at async Object.autocomplete (/home/container/commands/party.js:44:7)
    at async Client.<anonymous> (/home/container/index.js:98:17) {
  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/1250121020724088872/aW50ZXJhY3Rpb246MTI1MDEyMTAyMDcyNDA4ODg3Mjp3aUJMYTd2VVNzTVE4eFdOVjhUeWhmNkNJNUh4S0lTWlVKR0s1Mmc2OHdxVWtCam5PdTZQYU0yZXNJTTVFUjd5TTV4OGV3ZDJpSFl2cUZyYVpReGpDTXVyYkxmY1gyZXF0bm1ZcXUwM09INjlHYXplV2Q4Zk16UEhDMVViYmxBcQ/callback'
}

Code sample

const command = new SlashCommandBuilder()
  .setName("party")
  .setDescription("Input party-event to google sheet");

command.addAttachmentOption((option) =>
  option.setName("image").setDescription("Image File").setRequired(true)
);

command.addStringOption((option) =>
  option
    .setName("1")
    .setDescription(Description)
    .setRequired(true)
    .setAutocomplete(true)
);

for (let i = 2; i <= Party; i++) {
  command.addStringOption((option) =>
    option
      .setName(i.toString())
      .setDescription(Description)
      .setRequired(false)
      .setAutocomplete(true)
  );
}

module.exports = {
  data: command,
  async autocomplete(interaction) {
    try {
      const cacheData = mapData.get('Checkname') || [];
      const choices = cacheData.flat();
      const focusedValue = interaction.options.getFocused();
      const filtered = choices.filter((choice) => choice.normalize().toLowerCase().includes(focusedValue.normalize().toLowerCase()));

      const options = filtered.slice(0, 25).map(option => ({ name: option, value: option }));

      await interaction.respond(options);
    } catch (error) {
      console.error('Error in autocomplete:', error);
      await interaction.respond([]);
    }
  },
};

Versions

  • discord.js 14.15.3
  • Node.js v18.12.1
  • windows 10

Issue priority

Medium (should be fixed soon)

Which partials do you have configured?

User, Channel, GuildMember, Message, Reaction, GuildScheduledEvent, ThreadMember

Which gateway intents are you subscribing to?

Guilds, GuildMembers, GuildEmojisAndStickers, GuildMessages, GuildMessageReactions, DirectMessages, MessageContent

I have tested this issue on a development release

c5d40d3

@Jiralite
Copy link
Member

Jiralite commented Jun 12, 2024

You appear to be describing behaviour on Discord. discord.js does not influence how the Discord client works. You should report this issue to Discord. I also would not be surprised if your response is taking more than 3 seconds—the flattening and normalisations give it away.

@Jiralite Jiralite closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants