HTTP-400: Required options must be placed before non-required options
Summary
The bot can't start cause of the gateway returning an invalid form body error.
Reproduction Steps
Make a command from the given function.
Minimal Reproducible Code
@bot.command(guild_ids=[valid guild ids], name="test", description="Test description")
async def test_command(
ctx : InteractionContext,
user : Option(OptionType.user, "Who?", required=False, default=None),
bool : Option(OptionType.boolean, "True or false?", reqired=False, default=False)
):
Expected Results
Update commands, connect, be ready.
Actual Results
Ignoring exception in on_connect Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 351, in _run_event await coro(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/discord/bot.py", line 370, in on_connect await self.register_commands() File "/usr/local/lib/python3.9/site-packages/discord/bot.py", line 196, in register_commands cmds = await self.http.bulk_upsert_guild_commands(self.user.id, guild_id, File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 335, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In options.1: Required options must be placed before non-required options ^Croot@vmd72452:~/jokes/test# ./jokes-bot.py Ignoring exception in on_connect Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 351, in _run_event await coro(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/discord/bot.py", line 370, in on_connect await self.register_commands() File "/usr/local/lib/python3.9/site-packages/discord/bot.py", line 196, in register_commands cmds = await self.http.bulk_upsert_guild_commands(self.user.id, guild_id, File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 335, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In options.1: Required options must be placed before non-required options
Intents
None
System Information
python 3.9
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Context
No response
@bot.command(guild_ids=[valid guild ids], name="test", description="Test description")
async def test_command(
ctx : InteractionContext,
user : Option(OptionType.user, "Who?", required=False, default=None),
bool : Option(OptionType.boolean, "True or false?", required=False, default=False)
):
Spelling mistake in your code
You have misspelled required as reqired
You have misspelled
requiredasreqired
Thanks!