Bot works on windows, but not on ubuntu.

I am following the tutorial for slash commands and have copied exactly what is in the documentation. When running the /user command, it works on Windows, but Ubuntu returns an error:
DiscordAPIError[10062]: Unknown interaction
at handleErrors (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:736:23)
at async REST.request (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async ChatInputCommandInteraction.reply (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
at async Object.execute (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/events/interaction-create.js:16:4) {
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/1129538533028270102/aW50ZXJhY3Rpb246MTEyOTUzODUzMzAyODI3MDEwMjpPaktyQWRjOW9Bd1lOclBHSHZCc0FBS2tlcUMydllRdTdGQ21LSFJKZUV1OVVicEVhbFNvSFlMWXpIM2VKc2hNMTBwT3Z6OXppNktrNE9NV0loZDF4UXBTZnVIRXJlQVlxcTQ4cE9FcHF6TWN5MU9jeXBsVERlTkV2cHhqTUZtSQ/callback'
}
DiscordAPIError[10062]: Unknown interaction
at handleErrors (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:736:23)
at async REST.request (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async ChatInputCommandInteraction.reply (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
at async Object.execute (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/events/interaction-create.js:16:4) {
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/1129538533028270102/aW50ZXJhY3Rpb246MTEyOTUzODUzMzAyODI3MDEwMjpPaktyQWRjOW9Bd1lOclBHSHZCc0FBS2tlcUMydllRdTdGQ21LSFJKZUV1OVVicEVhbFNvSFlMWXpIM2VKc2hNMTBwT3Z6OXppNktrNE9NV0loZDF4UXBTZnVIRXJlQVlxcTQ4cE9FcHF6TWN5MU9jeXBsVERlTkV2cHhqTUZtSQ/callback'
}
23 Replies
d.js toolkit
d.js toolkit2y ago
- What's your exact discord.js npm list discord.js and node node -v version? - Post the full error stack trace, not just the top part! - Show your code! - Explain what exactly your issue is. - Not a discord.js issue? Check out #useful-servers. - Issue solved? Press the button!
Hazelwize
HazelwizeOP2y ago
My code is here: https://github.com/Hazelwize/role-reactor I am on Node version: 20.4.0 I have tested on Node version: 18.16.1 and 20.4.0 Discord.js version: 14.11.0
GitHub
GitHub - Hazelwize/role-reactor
Contribute to Hazelwize/role-reactor development by creating an account on GitHub.
d.js docs
d.js docs2y ago
Common causes of DiscordAPIError[10062]: Unknown interaction: - Initial response took more than 3 seconds ➞ defer the response *. - Wrong interaction object inside a collector. * Note: you cannot defer modal or autocomplete value responses
Hazelwize
HazelwizeOP2y ago
I get the same error when deferring the reply.
SpecialSauce
SpecialSauce2y ago
What’s the latency of the Ubuntu machine? The code you have is pretty bare bones it should be replying/deferring in enough time. The error also suggests that you’re replying right in the interaction create file but that doesn’t match the repo.
Hazelwize
HazelwizeOP2y ago
How would I check the latency? I think you might be on to something, because I just got a response from the bot, but I have to send two slash commands back to back. The first request fails, but the second command gets a response. Ok, weird workaround for my issue that I found. If I'm on a VPN then my bot works beautifully on Ubuntu. It works on Windows either way. I'm guessing this is 100% an issue with my setup in some way.
Robbe
Robbe2y ago
Probably just hitting the 3 second timeout timer, make sure you use deferReply as early as possible if (interaction.commandName === 'ping') { await interaction.deferReply(); // Defer the reply to ensure the command is acknowledged const replyTimestamp = interaction.createdTimestamp; const currentTimestamp = Date.now(); const latency = currentTimestamp - replyTimestamp; await interaction.followUp(Pong! Latency: ${latency}ms); }
Hazelwize
HazelwizeOP2y ago
It's still throwing the Unknown Interaction error when using deferReply(). I put the code you posted inside of the execute function for interactionCreate.
SpecialSauce
SpecialSauce2y ago
Seems weird. Sounds like a network issue.
Hazelwize
HazelwizeOP2y ago
That's what I'm thinking. This is my 4th day on the issue. I'm ok just using a VPN at this point. haha
d.js docs
d.js docs2y ago
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.
client
.on("debug", console.log)
.on("warn", console.log)
client
.on("debug", console.log)
.on("warn", console.log)
- Note: if you initialize your Client as bot or other identifiers you need to use these instead of client - If the output is too long to post consider using a bin instead: gist | paste.gg | sourceb.in | hastebin
Warmpigman
Warmpigman2y ago
Post output of "date" and "curl HTTPS://discord.com" in the terminal
Warmpigman
Warmpigman2y ago
And this? Without vpn Was the two previous commands without vpn aswell?
Hazelwize
HazelwizeOP2y ago
Provided token: MTEyODQ0MTI1NDI4NDM2NTg1NA.GvKjqD.**************************************
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 987
[WS => Shard 0] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 0] Waiting for event hello for 60000ms
[WS => Shard 0] Preparing first heartbeat of the connection with a jitter of 0.4160895576012904; waiting 17163ms
[WS => Shard 0] Waiting for identify throttle
[WS => Shard 0] Identifying
shard id: 0
shard count: 1
intents: 1
compression: none
[WS => Shard 0] Waiting for event ready for 15000ms
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
Ready! Logged in as RoleReactor#3407
You got to the execution of /user
[WS => Shard 0] First heartbeat sent, starting to beat every 41250ms
[WS => Shard 0] Heartbeat acknowledged, latency of 26ms.
Error executing user
DiscordAPIError[10062]: Unknown interaction
at handleErrors (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:736:23)
at async REST.request (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async ChatInputCommandInteraction.reply (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
at async Object.execute (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/commands/fun/user.js:12:3)
at async Object.execute (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/events/interaction-create.js:17:4) {
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/1129918285413105685/aW50ZXJhY3Rpb246MTEyOTkxODI4NTQxMzEwNTY4NTpZcE5tSHY5TUhWSUwwQkI3WHZWR2hvaThxZFYzbVFwa1hXTmljTTVJRFpXclFuNjdOdG1keVJEY2hCejNkSEJYUG45ZmZ1TjA5SGVJeTB3NXpFeVRMVlphS3lYU2lselhsTG5PUlhtdnJLcGVVTGRRSFg4UjZldEpydTBSNk9tbg/callback'
}
Provided token: MTEyODQ0MTI1NDI4NDM2NTg1NA.GvKjqD.**************************************
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 987
[WS => Shard 0] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 0] Waiting for event hello for 60000ms
[WS => Shard 0] Preparing first heartbeat of the connection with a jitter of 0.4160895576012904; waiting 17163ms
[WS => Shard 0] Waiting for identify throttle
[WS => Shard 0] Identifying
shard id: 0
shard count: 1
intents: 1
compression: none
[WS => Shard 0] Waiting for event ready for 15000ms
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
Ready! Logged in as RoleReactor#3407
You got to the execution of /user
[WS => Shard 0] First heartbeat sent, starting to beat every 41250ms
[WS => Shard 0] Heartbeat acknowledged, latency of 26ms.
Error executing user
DiscordAPIError[10062]: Unknown interaction
at handleErrors (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:736:23)
at async REST.request (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async ChatInputCommandInteraction.reply (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
at async Object.execute (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/commands/fun/user.js:12:3)
at async Object.execute (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/events/interaction-create.js:17:4) {
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/1129918285413105685/aW50ZXJhY3Rpb246MTEyOTkxODI4NTQxMzEwNTY4NTpZcE5tSHY5TUhWSUwwQkI3WHZWR2hvaThxZFYzbVFwa1hXTmljTTVJRFpXclFuNjdOdG1keVJEY2hCejNkSEJYUG45ZmZ1TjA5SGVJeTB3NXpFeVRMVlphS3lYU2lselhsTG5PUlhtdnJLcGVVTGRRSFg4UjZldEpydTBSNk9tbg/callback'
}
Warmpigman
Warmpigman2y ago
Unless something is wrong with your registering code, which I don't think so because it works on your windows machine, I'd go with network since it works with VPN.
Hazelwize
HazelwizeOP2y ago
I can't remember if it was on or not. Here it is with it off for sure:
SpecialSauce
SpecialSauce2y ago
Is this with the vpn off?
Hazelwize
HazelwizeOP2y ago
Yes, this is with the vpn off
Robbe
Robbe2y ago
If you simply place try { interaction.deferReply(); } catch(err) { Console.log(err) } At the start of execute function at interactionCreate.js what error do you get? @hazelwize
Hazelwize
HazelwizeOP2y ago
Provided token: MTEyODQ0MTI1NDI4NDM2NTg1NA.GvKjqD.**************************************
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 984
[WS => Shard 0] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 0] Waiting for event hello for 60000ms
[WS => Shard 0] Preparing first heartbeat of the connection with a jitter of 0.6348442557756107; waiting 26187ms
[WS => Shard 0] Waiting for identify throttle
[WS => Shard 0] Identifying
shard id: 0
shard count: 1
intents: 1
compression: none
[WS => Shard 0] Waiting for event ready for 15000ms
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
Ready! Logged in as RoleReactor#3407
You got to the execution of /user
Error executing user
DiscordAPIError[10062]: Unknown interaction
at handleErrors (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:736:23)
at async REST.request (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async ChatInputCommandInteraction.reply (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
at async Object.execute (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/commands/fun/user.js:12:3)
at async Object.execute (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/events/interaction-create.js:26:4) {
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/1129936142125518959/aW50ZXJhY3Rpb246MTEyOTkzNjE0MjEyNTUxODk1OTpabVg2UDN6Qkl3RXV3WTNBaHR1eUpVdkMxelZjTWxZc1RHTGkyRG5NZjZxVlZRcTFHc1ZlV3FHdzJOd2hUTVc2VlEyaTFwenpqbmt2SjRtc3R6MUxEYVZvUmFuRm9UdkJNTUpOVkJnRktybUE1dG85S3JPSDdaZUlqUlhXZGlVQg/callback'
}
/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:640
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[10062]: Unknown interaction
at handleErrors (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:736:23)
at async REST.request (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async ChatInputCommandInteraction.deferReply (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:69:5) {
requestBody: { files: undefined, json: { type: 5, data: { flags: undefined } } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1129936142125518959/aW50ZXJhY3Rpb246MTEyOTkzNjE0MjEyNTUxODk1OTpabVg2UDN6Qkl3RXV3WTNBaHR1eUpVdkMxelZjTWxZc1RHTGkyRG5NZjZxVlZRcTFHc1ZlV3FHdzJOd2hUTVc2VlEyaTFwenpqbmt2SjRtc3R6MUxEYVZvUmFuRm9UdkJNTUpOVkJnRktybUE1dG85S3JPSDdaZUlqUlhXZGlVQg/callback'
}
Provided token: MTEyODQ0MTI1NDI4NDM2NTg1NA.GvKjqD.**************************************
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 984
[WS => Shard 0] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 0] Waiting for event hello for 60000ms
[WS => Shard 0] Preparing first heartbeat of the connection with a jitter of 0.6348442557756107; waiting 26187ms
[WS => Shard 0] Waiting for identify throttle
[WS => Shard 0] Identifying
shard id: 0
shard count: 1
intents: 1
compression: none
[WS => Shard 0] Waiting for event ready for 15000ms
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
Ready! Logged in as RoleReactor#3407
You got to the execution of /user
Error executing user
DiscordAPIError[10062]: Unknown interaction
at handleErrors (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:736:23)
at async REST.request (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async ChatInputCommandInteraction.reply (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
at async Object.execute (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/commands/fun/user.js:12:3)
at async Object.execute (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/events/interaction-create.js:26:4) {
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/1129936142125518959/aW50ZXJhY3Rpb246MTEyOTkzNjE0MjEyNTUxODk1OTpabVg2UDN6Qkl3RXV3WTNBaHR1eUpVdkMxelZjTWxZc1RHTGkyRG5NZjZxVlZRcTFHc1ZlV3FHdzJOd2hUTVc2VlEyaTFwenpqbmt2SjRtc3R6MUxEYVZvUmFuRm9UdkJNTUpOVkJnRktybUE1dG85S3JPSDdaZUlqUlhXZGlVQg/callback'
}
/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:640
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[10062]: Unknown interaction
at handleErrors (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:736:23)
at async REST.request (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async ChatInputCommandInteraction.deferReply (/mnt/0EA6F184A6F16C99/100Devs/Practice Projects/role-bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:69:5) {
requestBody: { files: undefined, json: { type: 5, data: { flags: undefined } } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1129936142125518959/aW50ZXJhY3Rpb246MTEyOTkzNjE0MjEyNTUxODk1OTpabVg2UDN6Qkl3RXV3WTNBaHR1eUpVdkMxelZjTWxZc1RHTGkyRG5NZjZxVlZRcTFHc1ZlV3FHdzJOd2hUTVc2VlEyaTFwenpqbmt2SjRtc3R6MUxEYVZvUmFuRm9UdkJNTUpOVkJnRktybUE1dG85S3JPSDdaZUlqUlhXZGlVQg/callback'
}
Robbe
Robbe2y ago
Try to console.log(interaction) at the start of the user.js execute, also add try...catch with console.log(err) in that file. If you are deferring the reply right at interactionCreate.js start, then it either takes over 3 seconds to even reach your host or there is a problem with routing the interaction from interactionCreate.js to the correct command.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server