Validation Error - Expected a string primitive

Hi. When I add this piece of code to my SlashCommandBuilder
.addIntegerOption(option =>
option
.setMinValue(0)
.setMaxValue(challengesData.length - 1)
.setRequired(false))
.addIntegerOption(option =>
option
.setMinValue(0)
.setMaxValue(challengesData.length - 1)
.setRequired(false))
I get this error
ValidationError: Expected a string primitive
at StringValidator.handle (D:\Projekti\discord-bots\challenger\bot\node_modules\@sapphire\shapeshift\dist\index.js:1654:70)
at StringValidator.parse (D:\Projekti\discord-bots\challenger\bot\node_modules\@sapphire\shapeshift\dist\index.js:113:88)
at validateName (D:\Projekti\discord-bots\challenger\bot\node_modules\@discordjs\builders\dist\interactions\slashCommands\Assertions.cjs:11:17)
at Object.validateRequiredParameters (D:\Projekti\discord-bots\challenger\bot\node_modules\@discordjs\builders\dist\interactions\slashCommands\Assertions.cjs:26:3)
at MixedClass.runRequiredValidations (D:\Projekti\discord-bots\challenger\bot\node_modules\@discordjs\builders\dist\interactions\slashCommands\mixins\ApplicationCommandOptionBase.cjs:19:16)
at MixedClass.toJSON (D:\Projekti\discord-bots\challenger\bot\node_modules\@discordjs\builders\dist\interactions\slashCommands\options\integer.cjs:40:10)
at D:\Projekti\discord-bots\challenger\bot\node_modules\@discordjs\builders\dist\interactions\slashCommands\SlashCommandBuilder.cjs:37:52
at Array.map (<anonymous>)
at MixedClass.toJSON (D:\Projekti\discord-bots\challenger\bot\node_modules\@discordjs\builders\dist\interactions\slashCommands\SlashCommandBuilder.cjs:37:29)
at Object.<anonymous> (D:\Projekti\discord-bots\challenger\bot\deploy-commands.js:11:29) {
validator: 's.string',
given: undefined
}
ValidationError: Expected a string primitive
at StringValidator.handle (D:\Projekti\discord-bots\challenger\bot\node_modules\@sapphire\shapeshift\dist\index.js:1654:70)
at StringValidator.parse (D:\Projekti\discord-bots\challenger\bot\node_modules\@sapphire\shapeshift\dist\index.js:113:88)
at validateName (D:\Projekti\discord-bots\challenger\bot\node_modules\@discordjs\builders\dist\interactions\slashCommands\Assertions.cjs:11:17)
at Object.validateRequiredParameters (D:\Projekti\discord-bots\challenger\bot\node_modules\@discordjs\builders\dist\interactions\slashCommands\Assertions.cjs:26:3)
at MixedClass.runRequiredValidations (D:\Projekti\discord-bots\challenger\bot\node_modules\@discordjs\builders\dist\interactions\slashCommands\mixins\ApplicationCommandOptionBase.cjs:19:16)
at MixedClass.toJSON (D:\Projekti\discord-bots\challenger\bot\node_modules\@discordjs\builders\dist\interactions\slashCommands\options\integer.cjs:40:10)
at D:\Projekti\discord-bots\challenger\bot\node_modules\@discordjs\builders\dist\interactions\slashCommands\SlashCommandBuilder.cjs:37:52
at Array.map (<anonymous>)
at MixedClass.toJSON (D:\Projekti\discord-bots\challenger\bot\node_modules\@discordjs\builders\dist\interactions\slashCommands\SlashCommandBuilder.cjs:37:29)
at Object.<anonymous> (D:\Projekti\discord-bots\challenger\bot\deploy-commands.js:11:29) {
validator: 's.string',
given: undefined
}
I can't figure out why is the error happening. Could anyone assist me on this?
2 Replies
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
chickenwing
chickenwingOP•3y ago
Oh, that's right Thanks 😅
Want results from more Discord servers?
Add your server