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

  1. Acknowledge first: call await interaction.deferReply() (or reply()) before editReply.
  2. If a reply already exists but you only need to change content, keep reply-then-edit ordering in your flow.
  3. For slow work, deferReply immediately at handler start, await the work, then editReply.
  4. 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

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


AI-assisted analysis of discordjs/discord.js@a81ed8a306 (2026-08-30). Data as JSON: /api/errors/c5d331f411730238. Report an issue: GitHub.