ValidationError: Expected a string primitive

C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\shapeshift\src\validators\StringValidator.ts:73
return this.ip(6);
^
ValidationError: Expected a string primitive
at _StringValidator.handle (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\shapeshift\src\validators\StringValidator.ts:73:19)
at _StringValidator.parse (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\shapeshift\src\validators\BaseValidator.ts:103:2)
at validateRequiredParameters (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@discordjs\builders\src\components\textInput\Assertions.ts:26:17)
at TextInputBuilder.toJSON (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@discordjs\builders\src\components\textInput\TextInput.ts:135:3)
at C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@discordjs\builders\src\components\ActionRow.ts:132:61
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@discordjs\builders\src\components\ActionRow.ts:132:32)
at C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@discordjs\builders\src\interactions\modals\Modal.ts:98:61
at Array.map (<anonymous>)
at ModalBuilder.toJSON (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@discordjs\builders\src\interactions\modals\Modal.ts:98:32) {
validator: 's.string',
given: undefined
C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\shapeshift\src\validators\StringValidator.ts:73
return this.ip(6);
^
ValidationError: Expected a string primitive
at _StringValidator.handle (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\shapeshift\src\validators\StringValidator.ts:73:19)
at _StringValidator.parse (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\shapeshift\src\validators\BaseValidator.ts:103:2)
at validateRequiredParameters (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@discordjs\builders\src\components\textInput\Assertions.ts:26:17)
at TextInputBuilder.toJSON (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@discordjs\builders\src\components\textInput\TextInput.ts:135:3)
at C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@discordjs\builders\src\components\ActionRow.ts:132:61
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@discordjs\builders\src\components\ActionRow.ts:132:32)
at C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@discordjs\builders\src\interactions\modals\Modal.ts:98:61
at Array.map (<anonymous>)
at ModalBuilder.toJSON (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@discordjs\builders\src\interactions\modals\Modal.ts:98:32) {
validator: 's.string',
given: undefined
Solution:
I fixed it, my dev had accidentally removed the .setLabel().
Jump to solution
3 Replies
Favna
Favna5mo ago
You're passing undefined into s.string.ip(6). Wherever you use shapeshift make sure you don't pass undefined.
ItzExotical
ItzExotical5mo ago
I am making a modal, and the error occurs when I try to open it.
const modal = new ModalBuilder()
.setCustomId("ticketing-settings")
.setTitle("📝 Ticketing Settings")

const limitInput = new TextInputBuilder()
.setCustomId("ticketing-settings-ticketlimit")
.setPlaceholder("Enter a number between 1 and 10")
.setMaxLength(1)
.setRequired(true)
.setStyle(TextInputStyle.Short)

const actionRow = new ActionRowBuilder<TextInputBuilder>().addComponents(limitInput);
modal.addComponents(actionRow);

await buttonInteraction.showModal(modal);
const modal = new ModalBuilder()
.setCustomId("ticketing-settings")
.setTitle("📝 Ticketing Settings")

const limitInput = new TextInputBuilder()
.setCustomId("ticketing-settings-ticketlimit")
.setPlaceholder("Enter a number between 1 and 10")
.setMaxLength(1)
.setRequired(true)
.setStyle(TextInputStyle.Short)

const actionRow = new ActionRowBuilder<TextInputBuilder>().addComponents(limitInput);
modal.addComponents(actionRow);

await buttonInteraction.showModal(modal);
Solution
ItzExotical
ItzExotical5mo ago
I fixed it, my dev had accidentally removed the .setLabel().