Skip to content

Commit

Permalink
Improve troubleshooting unknown interactions (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 authored Jun 30, 2024
1 parent 961c325 commit 623e785
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/introduction/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ Didn't find an answer? Try asking in [our Discord server](https://discord.gg/0hM
The JDK provides a utility for creating a thread dump of a running JVM process: `jstack -l <pid>` (that's an L for "Long")
Example: `jstack -l 1337 > dump.txt` This will list the thread dump and write it to a file called `dump.txt`.

!!! tip

You can get the PID using `jps -l`.

You can also create a thread dump directly in IntelliJ:

![](../assets/images/ide/thread_dump_1.png)
Expand Down
33 changes: 31 additions & 2 deletions docs/using-jda/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,41 @@ If you use these intents you are limited to 100 guilds on your bot. To allow the

## Interactions and Slash Commands

### This interaction failed / Unknown Interaction
### The application did not respond

This means you didn't acknowledge or reply to an interaction in time. You only have **3 seconds** to reply or acknowledge.
You have to use `event.deferReply().queue()`, `event.deferEdit().queue()`, `event.editMessage(...).queue()`, or `event.reply(...).queue()`. (If you don't `queue()` it won't do it)
You have to use `event.deferReply().queue()`, `event.deferEdit().queue()`, `event.editMessage(...).queue()`,
or `event.reply(...).queue()`. (If you don't `queue()` it won't do it)
<br>**Make sure your event listener code is executed.**

### Unknown Interaction

This exception can happen due to two reasons:

#### The interaction took longer than **3 seconds** to be acknowledged

Possible reasons why your response was too slow:

- JDA's WebSocket thread was blocked for too long, when you see the `This application did not respond` on Discord,
make a thread dump and look at the stack trace around `JDA MainWS-ReadThread` to see where it may have blocked
- Your interaction took too long to acknowledge, you can use `event.deferReply(boolean).queue()` to extend the response time to 15 minutes

!!! tip "Making a thread dump"

See `How do I make a thread dump?` in the [FAQ](../introduction/faq.md).

#### The interaction was acknowledged by another process running the same bot

You can confirm this by checking if your bot replied,
or the three dots in a button disappeared without saying `This interaction failed`,
or you see '[Bot] is thinking...' for more than 3 seconds.

To resolve this, try stopping all current processes for the bot that could be responsible, or resetting your bot token.

!!! tip "Resetting your token"

You can reset your token in your [application dashboard](https://discord.com/developers/applications).

### Interaction Followup Messages Timed out

This means you sent followup messages through `InteractionHook.sendMessage(...)` or similar but never acknowledged the interaction.

0 comments on commit 623e785

Please sign in to comment.