discordjs/discord.js · error · DiscordjsError
InteractionNotReplied
InteractionNotReplied
Error message
The reply to this interaction has not been sent or deferred.
What it means
editReply edits the interaction's initial response ('@original' by default) through the interaction webhook, which only exists once the interaction has been deferred or replied. If neither flag is set, the library throws InteractionNotReplied rather than hitting Discord's 'Unknown interaction/webhook' failure.
Source
Thrown at packages/discord.js/src/structures/interfaces/InteractionResponses.js:184
*
* @typedef {WebhookMessageEditOptions} InteractionEditReplyOptions
* @property {MessageResolvable|'@original'} [message='@original'] The response to edit
*/
/**
* Edits a reply to this interaction.
*
* @see Webhook#editMessage
* @param {string|MessagePayload|InteractionEditReplyOptions} options The new options for the message
* @returns {Promise<Message>}
* @example
* // Edit the initial reply to this interaction
* interaction.editReply('New content')
* .then(console.log)
* .catch(console.error);
*/
async editReply(options) {
if (!this.deferred && !this.replied) throw new DiscordjsError(ErrorCodes.InteractionNotReplied);
const msg = await this.webhook.editMessage(options.message ?? '@original', options);
this.replied = true;
return msg;
}
/**
* Deletes a reply to this interaction.
*
* @see Webhook#deleteMessage
* @param {MessageResolvable|'@original'} [message='@original'] The response to delete
* @returns {Promise<void>}
* @example
* // Delete the initial reply to this interaction
* interaction.deleteReply()
* .then(console.log)
* .catch(console.error);
*/
async deleteReply(message = '@original') {View on GitHub (pinned to a81ed8a306)
Solutions
- Acknowledge first: call await interaction.deferReply() (or reply()) before editReply.
- If a reply already exists but you only need to change content, keep reply-then-edit ordering in your flow.
- For slow work, deferReply immediately at handler start, await the work, then editReply.
- If the interaction may be stale (>15 min), create a new message via channel.send instead of editing the webhook message.
Example fix
// before
await interaction.editReply('Result ready'); // throws if nothing was sent
// after
await interaction.deferReply();
const result = await doSlowWork();
await interaction.editReply(`Result: ${result}`); Defensive patterns
Strategy: validation
Validate before calling
if (!interaction.deferred && !interaction.replied) {
await interaction.deferReply();
} Try / catch
try {
await interaction.editReply('Updated');
} catch (err) {
if (err?.code === 'InteractionNotReplied') {
await interaction.reply('Updated');
} else throw err;
} Prevention
- Always deferReply (or reply) before any editReply in your flow.
- Defer immediately at handler start when work may exceed 3 seconds.
- Remember the 15-minute interaction token window for edits.
- Never treat editReply as a way to create the initial reply.
When it happens
Trigger: Calling interaction.editReply() as the very first response to an interaction (no prior reply or defer), or calling it after the 3-second/15-minute validity window expired on a fresh/stale interaction object.
Common situations: Trying to 'defer by editing' — developers call editReply hoping it creates the reply; modal submit handlers editing a reply belonging to a different (already-consumed) interaction; long-running work exceeding the 3s ack window so the token expired.
Related errors
- InteractionAlreadyReplied
- Request timed out
- HTTPError(status, res.statusText, method, url, requestData)
- Session not available
- Not enough sessions remaining to spawn ${shardIds.length} sh
AI-assisted analysis of discordjs/discord.js@a81ed8a306 (2026-08-30).
Data as JSON: /api/errors/c5d331f411730238.
Report an issue: GitHub.