#base_type_min_length error when creating stringselectmenu

1 messages · Page 1 of 1 (latest)

jolly helm
#
roles.names = [ 'Open', 'closed' ]```
```js
await i.editReply({ content: 'Please wait building Message.', embeds: [], files: [], components: [] });
// need update image location.
const rrEmbed = await new EmbedBuilder()
  .setImage('https://cdn.discordapp.com/attachments/1013243774803128390/1123340945518235688/josh-redd-Pronouns.png')
  .setColor(16111466)
  .setFooter({ text: 'Make a selection.' });
const reactionRoles = new StringSelectMenuBuilder()
  .setCustomId('reaction_role')
  .setPlaceholder('Select Your Role');
if (rrMessageType === 'normal' || rrMessageType === 'additive' || rrMessageType === 'drop') {
  reactionRoles.setMaxValues(25);
  reactionRoles.setMinValues(1);
}
else if (rrMessageType === 'unique' || rrMessageType === 'binding') {reactionRoles.setMaxValues(1);}
// need to collect rrRoleLimit and put in at .setmaxvalues(1)
else if (rrMessageType === 'limited') {reactionRoles.setMaxValues(1);}
roles.names.forEach((name, index) => {
  console.log(name, index);
  reactionRoles.addOptions(
  new StringSelectMenuOptionBuilder()
    .setLabel(`${name}`)
    .setValue(`${index}`),
  );
});
const reactionRolesRow = new ActionRowBuilder()
.addComponents(reactionRoles);
const msg = await interaction.guild.channels.cache.get(rrChannelId).send({ embeds: [rrEmbed], components: [reactionRolesRow] });
#

I keep getting this error and I am unsure why, js DiscordAPIError[50035]: Invalid Form Body components[0].components[0].options[BASE_TYPE_MIN_LENGTH]: Must be 25 or more in length. at handleErrors (D:\discord bot\Robofish\node_modules\@discordjs\rest\dist\index.js:640:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SequentialHandler.runRequest (D:\discord bot\Robofish\node_modules\@discordjs\rest\dist\index.js:1021:23) at async SequentialHandler.queueRequest (D:\discord bot\Robofish\node_modules\@discordjs\rest\dist\index.js:862:14) at async REST.request (D:\discord bot\Robofish\node_modules\@discordjs\rest\dist\index.js:1387:22) at async TextChannel.send (D:\discord bot\Robofish\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:162:15) at async InteractionCollector.<anonymous> (D:\discord bot\Robofish\Commands\GlobalSlashCommands\Utility\createReactionRole.js:206:17) { requestBody: { files: [], json: { content: undefined, tts: false, nonce: undefined, embeds: [ { image: { url: 'https://cdn.discordapp.com/attachments/1013243774803128390/1123340945518235688/josh-redd-Pronouns.png' }, color: 16111466, footer: { text: 'Make a selection.', icon_url: undefined } } ], components: [ { type: 1, components: [ [Object] ] } ], username: undefined, avatar_url: undefined, allowed_mentions: undefined, flags: undefined, message_reference: undefined, attachments: undefined, sticker_ids: undefined, thread_name: undefined } }, rawError: { code: 50035, errors: { components: { '0': { components: { '0': [Object] } } } }, message: 'Invalid Form Body' }, code: 50035, status: 400, method: 'POST', url: 'https://discord.com/api/v10/channels/1012566747183853589/messages' }

#

I did a consol.log on my string select menu and it looked like this and I dont see any thing wrong with it when comparing it to my other string select menus that actually post js StringSelectMenuBuilder { data: { type: 3, custom_id: 'reaction_role', placeholder: 'Select Your Role', max_values: 25, min_values: 1 }, options: [ StringSelectMenuOptionBuilder { data: { emoji: undefined, label: 'Open', value: '0' } }, StringSelectMenuOptionBuilder { data: { emoji: undefined, label: 'closed', value: '1' } } ] }

#

and I am unsure what that error actually means

#

Any help would be appreciated.

sand rivet
#

reactionRoles.setMaxValues(25);Could you try removing this line? I'm wondering if setting 25 to the max means that you must also provide at least 25 options to pick from

#

It's also redundant for string select menus since there can never be more than 25 options anyways

jolly helm
#

And I want them to be multiselects unfortunately I have to head to work but I could try setting them based on the length of names

sand rivet
jolly helm
#

Thank you I'll give that a try in the morning hopefully that what it is

jolly helm
#

thank you