TextInputBuilder ValidationError

Hi, I can't seem to get TextInputBuilder v14.24.0. I keep getting the following error
ValidationError > s.string()
Expected a string primitive

Received:
| undefined


at _StringValidator.handle (\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:2615:70)
at _StringValidator.parse (\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:972:90)
at validateRequiredParameters (\node_modules\@discordjs\builders\dist\index.js:906:21)
at TextInputBuilder.toJSON (\node_modules\@discordjs\builders\dist\index.js:1528:5)
at LabelBuilder.toJSON (\node_modules\@discordjs\builders\dist\index.js:1757:29)
at \node_modules\@discordjs\builders\dist\index.js:2857:64
at Array.map (<anonymous>)
at ModalBuilder.toJSON (\node_modules\@discordjs\builders\dist\index.js:2857:35)
at UserContextMenuCommandInteraction.showModal (\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:402:46)
ValidationError > s.string()
Expected a string primitive

Received:
| undefined


at _StringValidator.handle (\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:2615:70)
at _StringValidator.parse (\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:972:90)
at validateRequiredParameters (\node_modules\@discordjs\builders\dist\index.js:906:21)
at TextInputBuilder.toJSON (\node_modules\@discordjs\builders\dist\index.js:1528:5)
at LabelBuilder.toJSON (\node_modules\@discordjs\builders\dist\index.js:1757:29)
at \node_modules\@discordjs\builders\dist\index.js:2857:64
at Array.map (<anonymous>)
at ModalBuilder.toJSON (\node_modules\@discordjs\builders\dist\index.js:2857:35)
at UserContextMenuCommandInteraction.showModal (\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:402:46)
const textInput = new TextInputBuilder()
.setCustomId("customId")
.setStyle(TextInputStyle.Paragraph)
.setRequired(true);

const labelText = new LabelBuilder()
.setLabel("Label")
.setDescription("Description")
.setTextInputComponent(textInput);

return await interaction.showModal(
new ModalBuilder()
.setCustomId("customId")
.setTitle("Title")
.addLabelComponents(labelText)
);
const textInput = new TextInputBuilder()
.setCustomId("customId")
.setStyle(TextInputStyle.Paragraph)
.setRequired(true);

const labelText = new LabelBuilder()
.setLabel("Label")
.setDescription("Description")
.setTextInputComponent(textInput);

return await interaction.showModal(
new ModalBuilder()
.setCustomId("customId")
.setTitle("Title")
.addLabelComponents(labelText)
);
10 Replies
d.js toolkit
d.js toolkit4w ago
<@778878730784210957>
discord.js@14.24.0 node v22.17.1
Inky
Inky4w ago
What’s ur /builders version npm why @discordjs/builders npm why gives the trace of the resolved version of the package Like if it’s being overridden by the project or constrained by another package
<@778878730784210957>
@discordjs/builders@1.13.0
node_modules/@discordjs/builders
@discordjs/builders@"^1.13.0" from discord.js@14.24.0
node_modules/discord.js
discord.js@"^14.24.0" from the root project
PS D:\MerciasQuill\mercias-quill>
@discordjs/builders@1.13.0
node_modules/@discordjs/builders
@discordjs/builders@"^1.13.0" from discord.js@14.24.0
node_modules/discord.js
discord.js@"^14.24.0" from the root project
PS D:\MerciasQuill\mercias-quill>
Inky
Inky4w ago
That’s the correct version Only customId and style is required for TextInputBuilder Is this the code you’re actually running?
<@778878730784210957>
i mean it goes through a custom interaction handler, but this is essentially it StringSelectMenuBuilder also works fine for the modals, its just when i try to use a TextInputBuilder that it gives me this error oh TextInputBuilder was being imported from @discordjs/builders instead of discord.js, sorry 😭
Inky
Inky4w ago
Changing that fixed the error?
<@778878730784210957>
yep
<@778878730784210957>
i was just clicking enter on whatever the first option was, i just didnt notice till i tried making a new quick handler
No description
d.js toolkit
d.js toolkit4w ago
The thread owner has marked this issue as solved.

Did you find this page helpful?