ModalSubmitInteractionFieldNotFound

This error appear in ALL modals (after new updates). Why might this error appear? This happens when sending data through a modal window, but not always
const modal = new ModalBuilder()
.setCustomId('modal')
.setTitle(modalTitle);

const idInput = new TextInputBuilder()
.setCustomId('invite_moderation_notification_content_or_embed')
.setLabel(modalInviteModerationNotificationContentOrEmbedLabel)
.setPlaceholder(modalInviteModerationNotificationContentOrEmbedPlaceholder)
.setStyle(TextInputStyle.Paragraph)
.setRequired(true);

const row = new ActionRowBuilder().addComponents(idInput);
modal.addComponents(row);

let submitted;
try {
await i.showModal(modal);
submitted = await i.awaitModalSubmit({time: 0});
await submitted.deferUpdate();
} catch (e) {
return;
}
const invite_moderation_notification_content_or_embed = submitted.fields.getTextInputValue('invite_moderation_notification_content_or_embed')
const modal = new ModalBuilder()
.setCustomId('modal')
.setTitle(modalTitle);

const idInput = new TextInputBuilder()
.setCustomId('invite_moderation_notification_content_or_embed')
.setLabel(modalInviteModerationNotificationContentOrEmbedLabel)
.setPlaceholder(modalInviteModerationNotificationContentOrEmbedPlaceholder)
.setStyle(TextInputStyle.Paragraph)
.setRequired(true);

const row = new ActionRowBuilder().addComponents(idInput);
modal.addComponents(row);

let submitted;
try {
await i.showModal(modal);
submitted = await i.awaitModalSubmit({time: 0});
await submitted.deferUpdate();
} catch (e) {
return;
}
const invite_moderation_notification_content_or_embed = submitted.fields.getTextInputValue('invite_moderation_notification_content_or_embed')
10 Replies
d.js toolkit
d.js toolkit15mo 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
Kameq
Kameq15mo ago
@vollar could you provide whole error log?
vlad vollar
vlad vollarOP14mo ago
The same error log, but with another custom id
TypeError [ModalSubmitInteractionFieldNotFound]: Required field with custom id "change_reminder_text_input" not found.
at ModalSubmitFields.getField (/root/asagi/node_modules/discord.js/src/structures/ModalSubmitFields.js:36:23)
at ModalSubmitFields.getTextInputValue (/root/asagi/node_modules/discord.js/src/structures/ModalSubmitFields.js:51:17)
at InteractionCollector.<anonymous> (file:///root/asagi/src/commands/tools/reminder.js:667:79)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ModalSubmitInteractionFieldNotFound'
}
TypeError [ModalSubmitInteractionFieldNotFound]: Required field with custom id "change_reminder_text_input" not found.
at ModalSubmitFields.getField (/root/asagi/node_modules/discord.js/src/structures/ModalSubmitFields.js:36:23)
at ModalSubmitFields.getTextInputValue (/root/asagi/node_modules/discord.js/src/structures/ModalSubmitFields.js:51:17)
at InteractionCollector.<anonymous> (file:///root/asagi/src/commands/tools/reminder.js:667:79)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ModalSubmitInteractionFieldNotFound'
}
monbrey
monbrey14mo ago
sounds like youve got duplicated listeners They arent filtering properly Specifically, the one on line 667 of reminder.js
vlad vollar
vlad vollarOP14mo ago
Do I need to specify different custom ids for the modal window and fields?
monbrey
monbrey14mo ago
generally yeah, you want your custom ids for everything to be fully unique
vlad vollar
vlad vollarOP14mo ago
Do you think if I do this, the problem might be solved?
monbrey
monbrey14mo ago
potentially yeah - what I can see from the error its looking for a field on a modal that doesnt have it So they must be getting crossed
vlad vollar
vlad vollarOP14mo ago
I looked at the code with reminder, there are different IDs
No description
vlad vollar
vlad vollarOP14mo ago
I don't understand why these errors didn't occur before ⬆️ up How do I filter this? like this?
const filter = (interaction) => interaction.customId === 'change_reminder_content'
const submitted = await i.awaitModalSubmit({filter, time: 0})
const filter = (interaction) => interaction.customId === 'change_reminder_content'
const submitted = await i.awaitModalSubmit({filter, time: 0})
Want results from more Discord servers?
Add your server