ValidationError: Expected the value to be a string or number

Greetings, I recently got a ValidationError saying Expected the value to be a string or number. Below is my code.
const type = new TextInputBuilder()
.setCustomId('SELL_EC_1_TYPE')
.setLabel('Type of creation—only one')
.setStyle(TextInputStyle.Short)
.setPlaceholder('Build, model, GFX, SFX, script...')
.setRequired(false)
const row0 = new ActionRowBuilder()
.addComponents(type)
const linkToProduct = new TextInputBuilder()
.setCustomId('SELL_EC_1_LINK')
.setLabel('Link to the product')
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder('https://create.roblox.com/... or https://cdn.discordapp.com/attachments/...')
.setRequired(false)
const row1 = new ActionRowBuilder()
.addComponents(linkToProduct)
const price = new TextInputBuilder()
.setCustomId('SELL_EC_1_PRICE')
.setLabel('Price to sell')
.setStyle(TextInputStyle.Short)
.setPlaceholder("Robux only. You'll lose 15%.")
.setRequired(false)
const row2 = new ActionRowBuilder()
.addComponents(price)
const profile = new TextInputBuilder()
.setCustomId('SELL_EC_1_PROFILE')
.setLabel('Your Rolox profile')
.setPlaceholder('Link, username, or ID only')

const type = new TextInputBuilder()
.setCustomId('SELL_EC_1_TYPE')
.setLabel('Type of creation—only one')
.setStyle(TextInputStyle.Short)
.setPlaceholder('Build, model, GFX, SFX, script...')
.setRequired(false)
const row0 = new ActionRowBuilder()
.addComponents(type)
const linkToProduct = new TextInputBuilder()
.setCustomId('SELL_EC_1_LINK')
.setLabel('Link to the product')
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder('https://create.roblox.com/... or https://cdn.discordapp.com/attachments/...')
.setRequired(false)
const row1 = new ActionRowBuilder()
.addComponents(linkToProduct)
const price = new TextInputBuilder()
.setCustomId('SELL_EC_1_PRICE')
.setLabel('Price to sell')
.setStyle(TextInputStyle.Short)
.setPlaceholder("Robux only. You'll lose 15%.")
.setRequired(false)
const row2 = new ActionRowBuilder()
.addComponents(price)
const profile = new TextInputBuilder()
.setCustomId('SELL_EC_1_PROFILE')
.setLabel('Your Rolox profile')
.setPlaceholder('Link, username, or ID only')

2 Replies
d.js toolkit
d.js toolkit2d 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
Holygent
HolygentOP2d ago
.setStyle(TextInputStyle.Short)
.setRequired(false)
const row3 = new ActionRowBuilder()
.addComponents(profile)
const images = new TextInputBuilder()
.setCustomId('SELL_EC_1_IMAGES')
.setLabel('Images of your creation')
.setPlaceholder('Separate by a comma and a space. https://cdn.discordapp.com/attachments/..., https://...')
.setStyle(TextInputStyle.Paragraph)
.setRequired(false)
const row4 = new ActionRowBuilder()
.addComponents(images)
const modal = new ModalBuilder()
.setCustomId('SELL_EC_2')
.setTitle('New Listing')
.addComponents(row0, row1, row2, row3, row4)
await interaction.showModal(modal)
.setStyle(TextInputStyle.Short)
.setRequired(false)
const row3 = new ActionRowBuilder()
.addComponents(profile)
const images = new TextInputBuilder()
.setCustomId('SELL_EC_1_IMAGES')
.setLabel('Images of your creation')
.setPlaceholder('Separate by a comma and a space. https://cdn.discordapp.com/attachments/..., https://...')
.setStyle(TextInputStyle.Paragraph)
.setRequired(false)
const row4 = new ActionRowBuilder()
.addComponents(images)
const modal = new ModalBuilder()
.setCustomId('SELL_EC_2')
.setTitle('New Listing')
.addComponents(row0, row1, row2, row3, row4)
await interaction.showModal(modal)
Here's the entire log:
LOC31: ValidationError > s.nativeEnum(T)
Expected the value to be a string or number

Received:
| undefined

at _NativeEnumValidator.handle (/Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2788:9)
at _NativeEnumValidator.parse (/Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)

LOC31: ValidationError > s.nativeEnum(T)
Expected the value to be a string or number

Received:
| undefined

at _NativeEnumValidator.handle (/Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2788:9)
at _NativeEnumValidator.parse (/Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)

at validateRequiredParameters (/Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@discordjs/builders/dist/index.js:1252:27)
at TextInputBuilder.toJSON (/Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@discordjs/builders/dist/index.js:1364:5)
at /Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@discordjs/builders/dist/index.js:1479:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (/Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@discordjs/builders/dist/index.js:1479:35)
at /Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@discordjs/builders/dist/index.js:1570:64
at Array.map (<anonymous>)
at ModalBuilder.toJSON (/Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@discordjs/builders/dist/index.js:1570:35)
at validateRequiredParameters (/Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@discordjs/builders/dist/index.js:1252:27)
at TextInputBuilder.toJSON (/Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@discordjs/builders/dist/index.js:1364:5)
at /Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@discordjs/builders/dist/index.js:1479:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (/Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@discordjs/builders/dist/index.js:1479:35)
at /Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@discordjs/builders/dist/index.js:1570:64
at Array.map (<anonymous>)
at ModalBuilder.toJSON (/Users/holygent/Desktop/RoGet-DiscordServer/RoGet/node_modules/@discordjs/builders/dist/index.js:1570:35)
Please note that the code continues here. I split it up because of the 2,000-character limit Further, the problem arose when I added the type TextInputBuilder(). It could work before then For some reason it works now. Thank you.

Did you find this page helpful?