`ModalBuilder` validation error

When creating a modal like this:
export default class InputSocialMediaAccountName extends CustomModal {
public override async build() {
this.setCustomId(PresetModal.InputSocialMediaAccountName)
.setTitle('Some title')
.setComponents([
new ActionRowBuilder<TextInputBuilder>() //
.setComponents([
new TextInputBuilder()
.setCustomId('handle')
.setLabel('Something')
.setMinLength(1)
.setPlaceholder('test')
.setRequired(true)
.setStyle(TextInputStyle.Short)
])
]);
}
}
export default class InputSocialMediaAccountName extends CustomModal {
public override async build() {
this.setCustomId(PresetModal.InputSocialMediaAccountName)
.setTitle('Some title')
.setComponents([
new ActionRowBuilder<TextInputBuilder>() //
.setComponents([
new TextInputBuilder()
.setCustomId('handle')
.setLabel('Something')
.setMinLength(1)
.setPlaceholder('test')
.setRequired(true)
.setStyle(TextInputStyle.Short)
])
]);
}
}
I'm running into this error: https://pastebin.com/S5fda8s4 Not sure what the issue could be as the validation error isn't really helpful (or I just don't know how to interpret it; CustomModal for reference
export default abstract class CustomModal extends ModalBuilder {
constructor(public readonly manager: ModalsManager) {
super();
}

public abstract build(): Promise<void>;
}
export default abstract class CustomModal extends ModalBuilder {
constructor(public readonly manager: ModalsManager) {
super();
}

public abstract build(): Promise<void>;
}
Pastebin
2025-01-13 13:31:20 - ERROR - Encountered error while handling an i...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
4 Replies
d.js toolkit
d.js toolkit6d 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!
Teixeira
TeixeiraOP6d ago
import { ModalBuilder } from 'discord.js'; and import { ActionRowBuilder } from '@discordjs/builders'; Damn.
d.js docs
d.js docs6d ago
discord.js includes multiple sub-packages, installing these separately can mess with internal code:
npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
Teixeira
TeixeiraOP6d ago
Ah I see. I don't have @discordjs/builders installed but I am using @sapphire/framework which does have it as a dependency I'm confused though I thought I'd only be able to import things that were direct dependencies of my project, not dependencies of dependencies

Did you find this page helpful?