DiscordAPError[10062]: Unknown Interaction

ts
const event: BotEvent = {
name: Events.InteractionCreate,
once: false,
async execute(interaction: Interaction) {

try {
// Check if the interaction is a button interaction and has the customId 'checkverif'
if (!interaction.isButton()) return;

if (interaction.customId !== 'checkverif') return;
await interaction.deferReply({ ephemeral: true })
ts
const event: BotEvent = {
name: Events.InteractionCreate,
once: false,
async execute(interaction: Interaction) {

try {
// Check if the interaction is a button interaction and has the customId 'checkverif'
if (!interaction.isButton()) return;

if (interaction.customId !== 'checkverif') return;
await interaction.deferReply({ ephemeral: true })
Sometimes it loads sometimes I get an instant error, while the first thing to do is to defer it. The id is good because when I console log the interaction it gives me the details
39 Replies
d.js toolkit
d.js toolkit9mo 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!
Hiro
Hiro9mo ago
I've seen the tag that says: - 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) But it shouldn't take 3 seconds to reply / console log The problem is sometimes if I add the .reply it will reply but after that I get the error Or sometimes if I use the .reply instead of deferReply it won't even reply and get the error instantly
LISPlaysYT
LISPlaysYT9mo ago
can you send me the error?
Hiro
Hiro9mo ago
Yes for sure!
Hiro
Hiro9mo ago
Pastebin
throw new DiscordAPIError(data, "code" in data ? data.code : data....
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.
Hiro
Hiro9mo ago
So I get the error no matter what I do Reply, deferReply just console log as well
LISPlaysYT
LISPlaysYT9mo ago
hmmm is this in index.js or a different file
Hiro
Hiro9mo ago
A different file When I console log the interaction, it gives me it
LISPlaysYT
LISPlaysYT9mo ago
send me all the code
Hiro
Hiro9mo ago
Of the index ?
LISPlaysYT
LISPlaysYT9mo ago
of this file that you are getting the error from
Hiro
Hiro9mo ago
Pastebin
import {ButtonInteraction, Events, Interaction, InteractionButtonCo...
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.
LISPlaysYT
LISPlaysYT9mo ago
hmmm
Hiro
Hiro9mo ago
And like I said it's weird sometimes it sends me a reply and sometimes not But it always gives me that error
LISPlaysYT
LISPlaysYT9mo ago
oh yea thats weird @Hiro can you send me a vid if you can of it working then it not working
Hiro
Hiro9mo ago
No description
Hiro
Hiro9mo ago
For example I got this but after that I got the error Sure But when I mean working it's just replying and still getting the error right after It's like 50/50 sometimes I get the reply sometimes not but 100% get the error Without code change it's 50/50
LISPlaysYT
LISPlaysYT9mo ago
i actually have no idea why thats like that
Hiro
Hiro9mo ago
That's why it's so weird I would understand if it's 0% or 100% But sometimes I get a reply sometimes not but still get the error anyway
LISPlaysYT
LISPlaysYT9mo ago
yea i dont know why its random
Hiro
Hiro9mo ago
.....
LISPlaysYT
LISPlaysYT9mo ago
?
Hiro
Hiro9mo ago
I mean I've been on this for like a day
LISPlaysYT
LISPlaysYT9mo ago
shit
d.js docs
d.js docs9mo 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
Hiro
Hiro9mo ago
Yes but non of those 3 apply The reply is instant and still get error, no 2 bots on the same moment
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
Hiro
Hiro9mo ago
But why do I get the error If I get a reply
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
Hiro
Hiro9mo ago
No description
Hiro
Hiro9mo ago
I get a reply
Hiro
Hiro9mo ago
No description
Hiro
Hiro9mo ago
I just did it now
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
Hiro
Hiro9mo ago
I only have one terminal open and restarted full pc to make sure
Hiro
Hiro9mo ago
Yes I think it is Seems like there is no fix nice
LISPlaysYT
LISPlaysYT9mo ago
great...