discord.js says the reply to this interaction has not been sent or deferred
The reply to this interaction has not been sent or deferred.Short answer
discord.js raises this when code edits or follows up an interaction that has no initial response yet. Send reply() or deferReply() first, within three seconds of the command arriving, and only then call editReply() or followUp(). Slow work should defer first, then edit the reply when it finishes.
Fix it fast
1Find out which cause you have
Open your command handler and list every call on the interaction in the order it runs. The first call must be reply() or deferReply(); an editReply() or followUp() that comes earlier is the bug.
grep -rn "editReply\|followUp\|deferReply\|interaction.reply" src/commands2Match what you see, then jump to its fix
- 1
The error names the missing reply on a line that calls editReply() or followUp()editReply or followUp runs before any initial responseFix - 2
The command takes a few seconds (database, HTTP call) and Discord shows it failedSlow work runs before the first response and the 3-second window closesFix - 3
Only some inputs fail, for example when a lookup returns nothingA branch ends without ever respondingFix
- 1
What does the error look like?
The reply to this interaction has not been sent or deferred.Slash command shows a loading state forever, or fails in the Discord client
Cause 1 of 3
editReply or followUp runs before any initial response
1Check
The guide describes reply() and deferReply() as the initial responses, and editReply() and followUp() as things you do after an initial response. Look for a code path where the second kind is reached first, for example inside an early branch.
grep -n -B6 "editReply" src/commands/*.js2Fix
Make the first call on every path a reply() or a deferReply(), and keep editReply() for after it.
await interaction.deferReply();
const result = await buildReport();
await interaction.editReply(`Done: ${result}`);3Verify
Run the command in a test server. It answers once and nothing is thrown.
node src/index.jsConfirmed by discordjs.guide
Cause 2 of 3
Slow work runs before the first response and the 3-second window closes
1Check
Discord requires an initial response within 3 seconds of receiving the event, or the token is invalidated. Any await before your first reply counts against that time.
grep -n "await" src/commands/report.js | head2Fix
Call deferReply() as the very first line, then do the slow work, then editReply(). You then have up to 15 minutes before the token becomes invalid.
async execute(interaction) {
await interaction.deferReply();
const rows = await db.query('SELECT 1');
await interaction.editReply(`Rows: ${rows.length}`);
}3Verify
Time the command. The loading state appears at once and the edit lands when the work ends.
console.time('cmd'); // wrap the handler and print console.timeEnd('cmd') at the endConfirmed by docs.discord.com
Cause 3 of 3
A branch ends without ever responding
1Check
Each interaction needs one initial response. An if-branch that returns early, or a catch block that only logs, leaves the interaction unanswered.
grep -n "return;\|catch" src/commands/*.js2Fix
Reply in every branch, including the not-found and error paths. reply() and deferReply() cannot send additional messages, so use followUp() for anything after the first.
const item = await lookup(interaction.options.getString('name'));
if (!item) {
await interaction.reply('Nothing found.'); // answer on this path too
return;
}
await interaction.reply(`Found: ${item.name}`);3Verify
Trigger the failing input on purpose and check that Discord shows your message.
node src/index.jsConfirmed by discordjs.guide
How do I stop it coming back?
- Put deferReply() at the top of any command that touches a database or another API.
- Review every early return in a handler and check that it answers the interaction first.
- Remember the 15-minute limit on editReply() and followUp() after the first response.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
DiscordAPIError[50035]: Invalid Form Body when sending a message or embed
DiscordAPIError[50035]: Invalid Form Body
Error 50035 means the request body or its Content-Type is invalid.
3 causes, each with a fixBack end
ng serve says it cannot determine the project or target
Cannot determine project for command.
The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.
3 causes, each with a fixBack end
ng fails with Cannot find module @angular/cli/bin/ng
Cannot find module '@angular/cli/bin/ng'
The ng command is the entry point to the Angular CLI package.
2 causes, each with a fixBack end
Angular app shows 'Cannot GET /' when served by a Node.js server
Cannot GET /dashboard
Cannot GET / is Express saying no route or file matches the request.
3 causes, each with a fixBack end
ng serve cannot find the dev-server builder package
Could not find the implementation for builder @angular/build:dev-server
The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.
3 causes, each with a fixBack end
Angular build says it cannot resolve '@angular/localize/init'
Can't resolve '@angular/localize/init' in '/usr/src/app/src'
The build imports @angular/localize, and that package is not in node_modules.
2 causes, each with a fix