2 months ago
I have no clue what this means or what the problem is.. ive been trying for like 2 hours now
npm warn config production Use --omit=dev instead.
> revo-fraktionen-bot@1.0.0 build
> tsc
src/events/interactionHandler.ts(313,7): error TS2741: Property 'primaryColor' is missing in type 'string[]' but required in type 'RoleColorsResolvable'.
ERROR: failed to build: failed to solve: process "npm run build" did not complete successfully: exit code: 2
Pinned Solution
2 months ago
found it , at the very bottom of your code there's the catch block in the main try/catch:
} catch (error) {
console.error('❌ Fehler in handleModalSubmit:', error);
try {
await (interaction as any).reply({ ... })this is the problem, your code already calls reply() successfully, but then something minor throws an error afterward, which triggers the catch block, which tries to call reply() a second time on an already-replied interaction , hence error 40060.
the fix is simple, in that catch block replace reply with followUp:
} catch (error) {
console.error('❌ Fehler in handleModalSubmit:', error);
try {
if (interaction.replied || interaction.deferred) {
await (interaction as any).followUp({
embeds: [createErrorEmbed('Fehler', 'Ein Fehler ist aufgetreten.')],
ephemeral: true,
}).catch(() => {});
} else {
await (interaction as any).reply({
embeds: [createErrorEmbed('Fehler', 'Ein Fehler ist aufgetreten.')],
ephemeral: true,
}).catch(() => {});
}
} catch (e) { ... }
}that one change should fix all the 40060 errors you're seeing
10 Replies
Status changed to Open Railway • about 2 months ago
2 months ago
Hey, did you check your interactionHandler.ts? The type error can be found there as the error you have attached suggests.
2 months ago
Hello slowlytomm,
the error is on line 313 of your interactionHandler.ts file, nothing to do with railway. you're passing a string array where RoleColorsResolvable is expected. can you share the code around line 313? once i see it i can give you the exact fix
domehane
Hello **slowlytomm,** the error is on line 313 of your interactionHandler.ts file, nothing to do with railway. you're passing a string array where RoleColorsResolvable is expected. can you share the code around line 313? once i see it i can give you the exact fix
2 months ago
Thanks for answering yall, uhm so I let the AI rewrite the code again.. Which means line 313 is now empty and something else
2 months ago
I dont know if this is the same issue, but ill just upload a log about the issue im having.. Ignore the weird brainrot names - just for testing lmao
Attachments
2 months ago
okay so based on the logs, the build issue is gone (the bot is running fine) the actual problem now is two different errors repeating over and over:
the first one is error 40060 "interaction has already been acknowledged" , so here your code is calling interaction.reply() after already responding to the interaction (probably with a deferReply or another reply earlier in the same handler) , in handleModalSubmit around line 927, you need to use interaction.editReply() instead of interaction.reply() if you already deferred it
the second error is error 10062 "unknown interaction" , discord interactions expire after 3 seconds if you don't respond your bot is taking too long before replying, so by the time it tries to respond, discord already killed the interaction. fix is to add await interaction.deferReply({ ephemeral: true }) at the very start of your handler before doing any async work, then use interaction.editReply() at the end
Hope this help you so to resume both errors are in the same handlers so fixing the defer/reply flow should solve both at once. can you share the code for handleModalSubmit and handleSelectMenuInteraction?
domehane
okay so based on the logs, the build issue is gone (the bot is running fine) the actual problem now is two different errors repeating over and over: the first one is error 40060 "interaction has already been acknowledged" , so here your code is calling `interaction.reply()` after already responding to the interaction (probably with a `deferReply` or another `reply` earlier in the same handler) , in `handleModalSubmit` around line 927, you need to use `interaction.editReply()` instead of `interaction.reply()` if you already deferred it the second error is error 10062 "unknown interaction" , discord interactions expire after 3 seconds if you don't respond your bot is taking too long before replying, so by the time it tries to respond, discord already killed the interaction. fix is to add `await interaction.deferReply({ ephemeral: true })` at the very start of your handler before doing any async work, then use `interaction.editReply()` at the end Hope this help you so to resume both errors are in the same handlers so fixing the defer/reply flow should solve both at once. can you share the code for handleModalSubmit and handleSelectMenuInteraction?
2 months ago
Hey, where can I find handleModalSubmit exactly? No clue where its at
slowlytomm
Hey, where can I find handleModalSubmit exactly? No clue where its at
2 months ago
it's in the file src/events/interactionHandler.ts , just open it and use ctrl+f to search for handleModalSubmit
2 months ago
can you paste the rest of the function? specifically what comes after the part where the code got cut off, the rename logic and anything after it. that's where the second accidental reply() is hiding
2 months ago
found it , at the very bottom of your code there's the catch block in the main try/catch:
} catch (error) {
console.error('❌ Fehler in handleModalSubmit:', error);
try {
await (interaction as any).reply({ ... })this is the problem, your code already calls reply() successfully, but then something minor throws an error afterward, which triggers the catch block, which tries to call reply() a second time on an already-replied interaction , hence error 40060.
the fix is simple, in that catch block replace reply with followUp:
} catch (error) {
console.error('❌ Fehler in handleModalSubmit:', error);
try {
if (interaction.replied || interaction.deferred) {
await (interaction as any).followUp({
embeds: [createErrorEmbed('Fehler', 'Ein Fehler ist aufgetreten.')],
ephemeral: true,
}).catch(() => {});
} else {
await (interaction as any).reply({
embeds: [createErrorEmbed('Fehler', 'Ein Fehler ist aufgetreten.')],
ephemeral: true,
}).catch(() => {});
}
} catch (e) { ... }
}that one change should fix all the 40060 errors you're seeing
domehane
found it , at the very bottom of your code there's the catch block in the main try/catch: ```ts } catch (error) { console.error('❌ Fehler in handleModalSubmit:', error); try { await (interaction as any).reply({ ... }) ``` this is the problem, your code already calls `reply()` successfully, but then something minor throws an error afterward, which triggers the catch block, which tries to call `reply()` a second time on an already-replied interaction , hence error 40060. the fix is simple, in that catch block replace `reply` with `followUp`: ```ts } catch (error) { console.error('❌ Fehler in handleModalSubmit:', error); try { if (interaction.replied || interaction.deferred) { await (interaction as any).followUp({ embeds: [createErrorEmbed('Fehler', 'Ein Fehler ist aufgetreten.')], ephemeral: true, }).catch(() => {}); } else { await (interaction as any).reply({ embeds: [createErrorEmbed('Fehler', 'Ein Fehler ist aufgetreten.')], ephemeral: true, }).catch(() => {}); } } catch (e) { ... } } ``` that one change should fix all the 40060 errors you're seeing
2 months ago
Wow you're da goat.. Enjoy the $10
Status changed to Solved brody • about 2 months ago
