{"record":{"id":"c5d331f411730238","repo":"discordjs/discord.js","slug":"interactionnotreplied","errorCode":"InteractionNotReplied","errorMessage":"The reply to this interaction has not been sent or deferred.","messagePattern":"The reply to this interaction has not been sent or deferred\\.","errorType":"error_code","errorClass":"DiscordjsError","httpStatus":null,"severity":"error","filePath":"packages/discord.js/src/structures/interfaces/InteractionResponses.js","lineNumber":184,"sourceCode":"   *\n   * @typedef {WebhookMessageEditOptions} InteractionEditReplyOptions\n   * @property {MessageResolvable|'@original'} [message='@original'] The response to edit\n   */\n\n  /**\n   * Edits a reply to this interaction.\n   *\n   * @see Webhook#editMessage\n   * @param {string|MessagePayload|InteractionEditReplyOptions} options The new options for the message\n   * @returns {Promise<Message>}\n   * @example\n   * // Edit the initial reply to this interaction\n   * interaction.editReply('New content')\n   *   .then(console.log)\n   *   .catch(console.error);\n   */\n  async editReply(options) {\n    if (!this.deferred && !this.replied) throw new DiscordjsError(ErrorCodes.InteractionNotReplied);\n    const msg = await this.webhook.editMessage(options.message ?? '@original', options);\n    this.replied = true;\n    return msg;\n  }\n\n  /**\n   * Deletes a reply to this interaction.\n   *\n   * @see Webhook#deleteMessage\n   * @param {MessageResolvable|'@original'} [message='@original'] The response to delete\n   * @returns {Promise<void>}\n   * @example\n   * // Delete the initial reply to this interaction\n   * interaction.deleteReply()\n   *   .then(console.log)\n   *   .catch(console.error);\n   */\n  async deleteReply(message = '@original') {","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/discordjs/discord.js/blob/a81ed8a306d37fdc746e26a634b6a42164ba2c8c/packages/discord.js/src/structures/interfaces/InteractionResponses.js#L166-L202","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nawait interaction.editReply('Result ready'); // throws if nothing was sent\n\n// after\nawait interaction.deferReply();\nconst result = await doSlowWork();\nawait interaction.editReply(`Result: ${result}`);","handlingStrategy":"validation","validationCode":"if (!interaction.deferred && !interaction.replied) {\n  await interaction.deferReply();\n}","typeGuard":null,"tryCatchPattern":"try {\n  await interaction.editReply('Updated');\n} catch (err) {\n  if (err?.code === 'InteractionNotReplied') {\n    await interaction.reply('Updated');\n  } else throw err;\n}","preventionTips":["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."],"tags":["interaction","missing-acknowledgement","discord-api","state"],"backgroundTag":"interaction-not-acknowledged","analyzedSha":"a81ed8a306d37fdc746e26a634b6a42164ba2c8c","analyzedAt":"2026-08-30T04:07:22.193Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}