Skip to content

Random 404-Unknown interaction Errors (code: 10062) #9507

@5-30

Description

@5-30

Summary

Random 404 errors pop up, I'm pretty sure sending a modal shouldn't take more than 5 seconds though.

Reproduction Steps

I ran the command /reupload with this code.

Minimal Reproducible Code

intents = discord.Intents.default()
intents.typing = False
intents.presences = False
intents.reactions = True
intents.members = True
intents.guilds = True

bot = commands.Bot(command_prefix="/", intents=intents)

@bot.event
async def on_ready():
    await bot.change_presence(activity=discord.Game(name="https://tiktools.fr/"))
    print(f"Bot is ready. Logged in as {bot.user.name}")
    synced = await bot.tree.sync()
    print(f"synced {len(synced)} command(s)")

@bot.tree.command(name="reupload", description="Génère une vidéo TikTok à partir d'un extrait de vidéo YouTube")
async def reupload(interaction: discord.Interaction):
    if interaction.user.id in active:
            await interaction.followup.send("Merci d'attendre la fin de l'opération précédente avant d'en démarrer une nouvelle !", ephemeral=True)
            return
    await interaction.response.send_modal(ReuploadModal())

bot.run([Token])

Where ReuploadModal is obviously defined as some modal.

Expected Results

I expected a modal to open for me to enter what I need the bot to do.

Actual Results

The modal opened, but I get this error :

2023-07-23 01:08:43 ERROR    discord.app_commands.tree Ignoring exception in command 'reupload'
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 828, in _do_call
    return await self._callback(interaction, **params)  # type: ignore
  File "/root/test.py", line 737, in reupload
    await interaction.response.send_modal(ReuploadModal())
  File "/usr/local/lib/python3.9/dist-packages/discord/interactions.py", line 972, in send_modal
    await adapter.create_interaction_response(
  File "/usr/local/lib/python3.9/dist-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 1248, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 853, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 846, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'reupload' raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction

It may seem as not that big of a deal, but it can completely break other parts of my code where I need to retrieve infos related to the response object.

Intents

See the code.

System Information

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

Another weird thing is the randomness of this error. Sometimes it pops up 3 times in a row, sometimes it just never does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    off-topicThis does not belong here.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions