Webhook Followup / Unknown Webhook (404)
Description
Whenever I respond to an interaction URL request with a defer, it goes through as normal, and Discord says that the "Application is thinking". However at random occurrence, whenever I wish to reply with /webhooks/:app_id/:followup_token, it would tell me that the webhook is not there (404). After making my script retry for 2-3 times in a span of ~10 seconds, it finally registers that it can reply and gets a HTTP 200 request.
Steps to Reproduce
- Use Interaction URL and not traditional websocket
- Reply to Discord's webhook request with following JSON
{
"type": 5,
"data": { "flags": 0 }
}
- Attempt to send a followup to
/webhooks/:app_id/:followup_tokenwith something as simple as{"content": "Hello world"} - Wait to see if that one moment you attempt, has the random occurance of not allowing you to reply (While testing before submitting this issue, I get it every 10'ish minutes)
Expected Behavior
Being able to reply to a defer instantly as shown here
Current Behavior
Random chance to return HTTP 404 until a few seconds has passed and Discord API finally lets you reply to the followup token.
Screenshots/Videos
They are provided above
Client and System Information
Library: discord.http (Python, Quart, aiohttp) OS: Windows 11 Pro
When replying to an HTTP response, there is no guarantee that Discord has received the response that you sent before it received your request for a follow up.
Discord probably needs to handle a follow up for an interaction where a result has not yet been replied to as resolving the interaction, and then dropping the http response asking it to be deferred when it receives the response.
When replying to an HTTP response, there is no guarantee that Discord has received the response that you sent before it received your request for a follow up.
Even if the client is saying that "Application is thinking", intentionally waiting 2 seconds before sending a followup, yet still getting a HTTP 404? Just asking since it feels a bit strange where the client shows that the API has accepted my defer response, yet followup token is unavailable at some random points, for a duration of 2-10 seconds (it's a bit random at times), which is after I can see that a defer has been handled by Discord.
https://github.com/user-attachments/assets/d0621988-d576-4c44-96af-0c829c274496
Hey, just commenting to see if there was any followup (no pun intended) to this issue. I still get HTTP 404 errors regardless of how much delay I add on top of the response, after the Discord client does in fact show that they have processed the response I gave and have triggered a "Application is thinking..." response to the client.
Have tried to delay the followup response all from 0.5 second to 5 seconds with the same outcome in all of them:
- "Unknown webhook (HTTP 404)" on all 5 tries within 10 seconds
- Very very delayed
HTTP 200response (anything between 1-4 tries), which is luckly, the most common outcome.
If there is anything else I can try, please let me know, because I have exhausted everything I could think of to make it possibly work again with 0 issues. It was working completly fine with the interactions were using websocket only, but converting my bot to be using Interaction URL introduced this problem.
+1 on this as mentioned in https://discord.com/channels/613425648685547541/1245841059515207821
+1 on this as well.
It's been a while, but I recently generally improved the robustness of the webhook endpoints, which might help this issue. Let me know if you still see Unknown Webhook codes.
Last time I encountered it as far, was 2 hours ago (I attempt to send the HTTP PATCH 5 times before giving up) but if it was after that, I will then update if I see anything else yes yes.
UNIX of when it happened: 1749060633
Update, it continues to happen today
I can also confirm it still happens, but perhaps a) less frequently and b) less severely (time duration), but admittedly my sample size is rather small now as we've mostly migrated to web pages and away from bots.
Looping back to this. Had another API latency spike today, and right smack in the middle of it hit the 404 problem again. Hit a run of 4 interactions inside of 10s.
From my side, they happen less frequently at least, they only happen whenever a server is getting heavy load (say an [at]everyone happens due to giveaway with around 600k members) otherwise I have seen them appear less, but they appear sometimes during normal behaviour.
Then maybe we pivot this from fixing the issue to establishing "best practices" that (ideally) completely mitigate the problem.
Update on the ongoing 404 issue
I have done all testing and benchmarking to rule out a local I/O bottleneck or late response at this point. Here is what my current findings have gotten me:
- Response Latency: My bot consistently responsds to the initial POST request within 10-200ms of the interaction being created by Discord (confirmed from the timestamp provided in the JSON data from Discord's POST request
- Followup Delay: I have tested adding intentional delays of 0.5s, 1s and 2s before attempting a followup/edit (after responding to the initial HTTP request from Discord). Even with these delays that I add, the API returns a HTTP 404 to my attempts at replying back, regardless of what method I use. It happens both when replying first with HTTP 202 to send a defer with a request back, or when replying with an initial defer (HTTP 200) from my end, as from the original comment of this issue.
- Retry logic: When a 404 is encountered, my bot retries up to 5 times over a span of 10 seconds. In these cases, all the 5 attempts fail with a 4040, even though I use the correct interaction token provided. What is more interesting is that it is random.. sometimes (majority of the time) it fails within the 3 seconds, as if Discord refused to take my initial request, other times it fails at "Bot is thinking" where it has acknowledged the defer, but refuses to take my request to reply, making it fail after 15 minutes.
- The "202 Method" failue: Following previous suggestions, I tried to respond to Discord's HTTP POST request with a "202 Empty", to then send a defer response through a request instead (making the point of interaction url kinda pointless for my usage, but sure). Even this method provides the same issue, it does not even reduce the errors.
It feels like the interaction token is occasionally invalid/unknown to certain Discord API nodes immediately upon creation, regardless of how fast the bot responds. This is particularly prevalent in high-population servers (eg. 1M+ members) even during non-peak times.
An example of how my benchmarks looked like in the end, I am sorry if it looks confusing.
Essentially in this example:
- Discord created an interaction at 2025-12-18 19:59:16.260000+00:00 according to the JSON data I got
- I processed the data and responded back at 2025-12-18 19:59:16.368055+00:00, making the delay ~9-10ms in this situation
- This happens in any situation where my bot took 10-200ms to respond
Benchmark code: https://github.com/AlexFlipnote/discord.http/blob/master/discord_http/utils.py#L38-L192 An example usage of it would be
with ctx.benchmark.measure("start_end:application_command", internal=True):
# ... logic ...
return WebResponse() # Data sent to Discord
# __exit__ triggered, timing recorded
At this point, I have exhausted every logical explanation for this being a "client-side", "network latency" or "I/O latency" issue. I would just appreciate it if this could be looked into again, why a successfully acknowledged interaction would return me a HTTP 404 later on when I attempt to create a followup later on. Would also like to mention that it seems that I am not the first one to notice this and have benchmarked it, as can be seen in #5558. The situation looks heavily similar, if not the same issue overall.