Fix "This interaction failed" and "The application did not respond"
Why Discord shows "This interaction failed" on buttons or "The application did not respond" on slash commands, and how to fix it with defer, followups and persistent views.
Your users see one of these in Discord:
This interaction failed
The application did not respondand your console may show one of these:
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
discord.errors.HTTPException: 400 Bad Request (error code: 40060): Interaction has already been acknowledged.Discord gives your bot 3 seconds to acknowledge every slash command, button press or menu choice. If it doesn't, the user sees the error and the interaction expires.
1. Read the console first #
- An exception in your command (a typo, a missing permission): the code crashed before it could respond. Fix that error; an error handler that always replies helps (see course Part 3).
- 10062 Unknown interaction: you answered after the 3 seconds ran out.
- 40060 already acknowledged: you answered twice, or two copies of your bot are running with the same token.
- Nothing at all: the bot is offline, or the view the button belongs to no longer exists (see step 3).
2. Slow command? Defer first #
If a command calls an API, a database or anything that can take more than a moment, acknowledge it straight away with defer(). Discord then shows "Bot is thinking…" and you get 15 minutes to send the real answer with followup.
@bot.tree.command(name="report", description="Build a slow report")
async def report(interaction: discord.Interaction) -> None:
await interaction.response.defer(thinking=True) # within 3 seconds
result = await build_report() # slow work, must be async
await interaction.followup.send(result)For a button that does slow work, use await interaction.response.defer() and then interaction.followup.send(...) or interaction.edit_original_response(...).
discord.js equivalent: await interaction.deferReply(); then await interaction.editReply("done");.
Defer doesn't help if the slow part is blocking code such as time.sleep() or requests.get(): that freezes the whole bot, including the defer. Use asyncio.sleep, aiohttp, or await asyncio.to_thread(slow_function).
3. Buttons stop working after a restart or a few minutes #
A normal discord.ui.View lives in memory with a timeout (180 seconds by default). After the timeout or a bot restart, old buttons have nothing listening and fail. For buttons that must work forever, such as role or ticket buttons, make the view persistent:
import discord
from discord.ext import commands
class RoleButtons(discord.ui.View):
def __init__(self) -> None:
super().__init__(timeout=None) # 1. never time out
@discord.ui.button(label="Get updates role", style=discord.ButtonStyle.success,
custom_id="roles:updates") # 2. fixed custom_id
async def updates(self, interaction: discord.Interaction, button: discord.ui.Button) -> None:
await interaction.response.send_message("Done!", ephemeral=True)
class MyBot(commands.Bot):
async def setup_hook(self) -> None:
self.add_view(RoleButtons()) # 3. re-register on every start
4. Respond exactly once #
Each interaction gets one interaction.response.… call. Anything after that goes through interaction.followup.send() or editing the original response. If you're not sure whether you already answered, check interaction.response.is_done().
Other causes #
- Two copies running (your PC and your host): one answers, the other errors with 40060. Stop one.
- Old commands left from a previous version: Discord still shows a command your code no longer has. Sync your command tree again. See syncing slash commands.
- Lag between your bot and Discord: a heavily loaded machine or a blocked event loop can eat the 3 seconds. See bot keeps disconnecting.
FAQ #
How long do I have to respond?
3 seconds for the first response (or defer). After deferring, follow-ups work for 15 minutes.
Should I always defer?
Defer when the work might take more than about a second. For instant replies, send_message directly is simpler.
Can I make the "thinking" message private?
Yes: interaction.response.defer(ephemeral=True, thinking=True), then send the follow-up with ephemeral=True.
/botfix in the ESN Systems Discord.Still stuck? Use the live chat on the panel or ask in the ESN Systems Discord. Last updated November 3, 2026.