DiscordAPIError[50035]: Invalid Form Body

After yesterdays scheduled restart, the following error appears after a button interaction reply. This code worked up until now.
DiscordAPIError[50035]: Invalid Form Body
data.components[1].components[0].options[1].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
...
at handleErrors (**/bot/node_modules/@discordjs/rest/dist/index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (**/bot/node_modules/@discordjs/rest/dist/index.js:826:23)
at async _REST.request (**/bot/node_modules/@discordjs/rest/dist/index.js:1266:22)
at async ButtonInteraction.reply(**/bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
at async VCManager.vcm_create(**/bot/dist/channelmanager/channel.js:239:9)
DiscordAPIError[50035]: Invalid Form Body
data.components[1].components[0].options[1].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
...
at handleErrors (**/bot/node_modules/@discordjs/rest/dist/index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (**/bot/node_modules/@discordjs/rest/dist/index.js:826:23)
at async _REST.request (**/bot/node_modules/@discordjs/rest/dist/index.js:1266:22)
at async ButtonInteraction.reply(**/bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
at async VCManager.vcm_create(**/bot/dist/channelmanager/channel.js:239:9)
new StringSelectMenuOptionBuilder({
label: 'Public',
value: 'public',
emoji: '🔓',
default: false,
})
new StringSelectMenuOptionBuilder({
label: 'Public',
value: 'public',
emoji: '🔓',
default: false,
})
After commenting out the emoji property emoji: '🔓', everything worked fine again. Is there anything I can do to fix this?
14 Replies
d.js toolkit
d.js toolkit12mo 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! - Marked as resolved by OP
Danial
Danial12mo ago
How are you importing StringSelectMenuOptionBuilder?
Xarot
XarotOP12mo ago
import { StringSelectMenuOptionBuilder } from "discord.js";
import { StringSelectMenuOptionBuilder } from "discord.js";
Like I said, everything was still working yesterday. I guess something new with DiscordAPI?
Danial
Danial12mo ago
Can you use toJSON() on the select menu and then log it and see what it shows?
treble/luna
treble/luna12mo ago
isnt emoji supposed to be an object
d.js docs
d.js docs12mo ago
dtypes v10: APIMessageComponentEmoji read more
Danial
Danial12mo ago
It resolves it into an object if it's string
Xarot
XarotOP12mo ago
Yeah, thats why I did it that way. Yes, give me a sec. I am losing my mind. It works now. Seems like it was an issue with the DiscordAPI not converting it right. So it had nothing to do with my code
Danial
Danial12mo ago
The builder converts it, the API doesn't take string, only an object
Xarot
XarotOP12mo ago
So there was something wrong with the builder?
Danial
Danial12mo ago
Nope, the code looks fine, it always supposed to return an object or null Very weird
Xarot
XarotOP12mo ago
Maybe you can figure out where the issue originated from. This is the whole log:
data.components[1].components[0].options[1].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[2].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[3].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[4].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[5].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[6].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[7].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[8].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[9].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[10].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[11].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[12].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[13].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[14].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[15].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[16].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[17].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[18].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[19].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[20].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[21].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[22].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[23].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[24].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
Stracktrace:

And then it repeats again
data.components[1].components[0].options[1].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[2].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[3].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[4].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[5].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[6].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[7].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[8].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[9].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[10].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[11].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[12].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[13].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[14].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[15].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[16].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[17].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[18].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[19].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[20].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[21].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[22].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[23].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
data.components[1].components[0].options[24].emoji[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
Stracktrace:

And then it repeats again
So how can the result be different, if my local files are the exact same as before. This is how it looks like when I log it to JSON: emoji: { animated: false, name: ':unlock:', id: undefined } Note that ':unlock:' looks like this 🔓 inside the log. Discord just edited my message Ok, so to wrap this up: Idk why but one StringSelectMenuOptionBuilder had an empty emoji string, which (NOW!) can not be converted to an object anymore. Anyways, thanks to you both @Danial 🐝 @arcticwolvinny ❄ 🌈 for helping me out with this one.
Danial
Danial12mo ago
Looks fine Like you passed in an empty string for one of them?
Xarot
XarotOP12mo ago
yeah like this: emoji: '', and it did work up until now 😄
Want results from more Discord servers?
Add your server