Cog-Creators / Red-DiscordBot

A multi-function Discord bot
https://docs.discord.red
GNU General Public License v3.0
4.76k stars 2.3k forks source link

Check responding to autocomplete interaction: 400 Bad Request - Value must be one of {8}. #6374

Closed vertyco closed 5 months ago

vertyco commented 5 months ago

What Red version are you using?

3.5.9

What were you trying to do?

Presumably get autocomplete results for something

What did you expect to happen?

The results to come through properly

What actually happened?

The exception seems like it was handled and just logged to sentry, although i'm not certain as I cant seem to repro it on purpose.

How can we reproduce this error?

I am not sure how to repro this error, it has occurred 19 times within the last 30 days during which i was unaware.

Anything else?

Raw Stack Trace

HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In type: Value must be one of {8}.
  File "discord/app_commands/tree.py", line 1089, in wrapper
    await self._call(interaction)
  File "discord/app_commands/tree.py", line 1210, in _call
    if not await self.interaction_check(interaction):
  File "redbot/core/tree.py", line 344, in interaction_check
    await interaction.response.send_message(
  File "discord/interactions.py", line 801, in send_message
    await adapter.create_interaction_response(
  File "discord/webhook/async_.py", line 221, in request
    raise HTTPException(response, data)

Breadcrumbs

image

image

Some insight from Zeph: check is responding to an autocomplete interaction, which only supports APPLICATION_COMMAND_AUTOCOMPLETE_RESULT (internally represented by the value 8 to Discord's API) responses

Zephyrkul commented 5 months ago

How can we reproduce this error?

I am not sure how to repro this error, it has occurred 19 times within the last 30 days during which i was unaware.

Presumably, based on this traceback, one could reproduce it by ignoring a channel or guild then attempting to use an app command that has autocomplete in that ignored channel or guild. I haven't tested this myself, yet, however.