Help command fails after being rate limited. #5905

Closed
opened 2022-11-16 00:56:10 +01:00 by TheWizardofGauze · 5 comments
TheWizardofGauze commented 2022-11-16 00:56:10 +01:00 (Migrated from github.com)

What Red version are you using?

3.4.18

Cog name

Core

Command name

help

What did you expect to happen?

All pages of the help list should be sent to DMs.

What actually happened?

A few pages are sent before the bot posts

Error in command 'help'. Check your console or logs for details.

and it abruptly stops.

How can we reproduce this error?

  1. Have a decent number of cogs installed (I have a total of 21).
  2. Run the 'help' command.
  3. Wait while it executes, until it stops and states the error.

Anything else?

Traceback:

Traceback (most recent call last):
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\redbot\core\commands\help.py", line 882, in red_help
    await ctx.bot.send_help_for(ctx, thing_to_get_help_for, from_help_command=True)
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\redbot\core\bot.py", line 1214, in send_help_for
    return await self._help_formatter.send_help(
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\redbot\core\commands\help.py", line 225, in send_help
    await self.format_bot_help(ctx, help_settings=help_settings)
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\redbot\core\commands\help.py", line 639, in format_bot_help
    await self.make_and_send_embeds(ctx, emb, help_settings=help_settings)
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\redbot\core\commands\help.py", line 531, in make_and_send_embeds
    await self.send_pages(ctx, pages, embed=True, help_settings=help_settings)
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\redbot\core\commands\help.py", line 830, in send_pages
    msg = await destination.send(embed=page)
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\abc.py", line 1065, in send
    data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\http.py", line 267, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 31001): You are being rate limited.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 429 Too Many Requests (error code: 31001): You are being rate limited.
### What Red version are you using? 3.4.18 ### Cog name Core ### Command name help ### What did you expect to happen? All pages of the help list should be sent to DMs. ### What actually happened? A few pages are sent before the bot posts > Error in command 'help'. Check your console or logs for details. and it abruptly stops. ### How can we reproduce this error? 1. Have a decent number of cogs installed (I have a total of 21). 2. Run the 'help' command. 3. Wait while it executes, until it stops and states the error. ### Anything else? Traceback: ```Exception in command 'help' Traceback (most recent call last): File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\redbot\core\commands\help.py", line 882, in red_help await ctx.bot.send_help_for(ctx, thing_to_get_help_for, from_help_command=True) File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\redbot\core\bot.py", line 1214, in send_help_for return await self._help_formatter.send_help( File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\redbot\core\commands\help.py", line 225, in send_help await self.format_bot_help(ctx, help_settings=help_settings) File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\redbot\core\commands\help.py", line 639, in format_bot_help await self.make_and_send_embeds(ctx, emb, help_settings=help_settings) File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\redbot\core\commands\help.py", line 531, in make_and_send_embeds await self.send_pages(ctx, pages, embed=True, help_settings=help_settings) File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\redbot\core\commands\help.py", line 830, in send_pages msg = await destination.send(embed=page) File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\abc.py", line 1065, in send data = await state.http.send_message(channel.id, content, tts=tts, embed=embed, File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\http.py", line 267, in request raise HTTPException(r, data) discord.errors.HTTPException: 429 Too Many Requests (error code: 31001): You are being rate limited. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke await ctx.command.invoke(ctx) File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke await injected(*ctx.args, **ctx.kwargs) File "C:\Users\Ian\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 429 Too Many Requests (error code: 31001): You are being rate limited.
Flame442 commented 2022-11-16 01:13:46 +01:00 (Migrated from github.com)

This is the second time this is getting reported, so something is definitely up with the rate limits today. I'm able to repro this right now running [p]help 3 times in a row. Seems like Discord pushed some kind of change to DM rate limits that dpy isn't handling correctly (are the headers wrong for some reason? wouldn't put it past Discord...). Keeping this open until this is resolved, or we hear word from Danny/Discord about what's up, because I swear this didn't happen in the past.

As a work around for now, you can use [p]helpset usemenus t to make help into a single-message menu, which should at least lower the amount of API requests it makes.

Edit: It also seems like the DM version of this issue only happens on 3.4.18, where as the reaction version of this issue only happens on 3.5.0.dev.

This is the second time this is getting reported, so something is definitely up with the rate limits today. I'm able to repro this right now running `[p]help` 3 times in a row. Seems like Discord pushed some kind of change to DM rate limits that dpy isn't handling correctly (are the headers wrong for some reason? wouldn't put it past Discord...). Keeping this open until this is resolved, or we hear word from Danny/Discord about what's up, because I swear this didn't happen in the past. As a work around for now, you can use `[p]helpset usemenus t` to make help into a single-message menu, which should at least lower the amount of API requests it makes. Edit: It also seems like the DM version of this issue _only_ happens on 3.4.18, where as the reaction version of this issue _only_ happens on 3.5.0.dev.
Flame442 commented 2022-11-16 05:41:57 +01:00 (Migrated from github.com)

Minimal code to reproduce River's similar issue with reactions on dpy 2.0 only is the following:

await asyncio.gather(*[ctx.message.add_reaction(e) for e in guild.emojis[:10]])

(Assuming your guild has 10 emojis)

Minimal code to reproduce River's similar issue with reactions on dpy 2.0 only is the following: ```py await asyncio.gather(*[ctx.message.add_reaction(e) for e in guild.emojis[:10]]) ``` (Assuming your guild has 10 emojis)
RheingoldRiver commented 2022-12-04 01:38:10 +01:00 (Migrated from github.com)

I got another rate limit error printed to channel just now (even after rolling back). Here's the traceback:

Exception in command 'idsearch'
Traceback (most recent call last):
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/ext/commands/core.py", line 187, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/bot/.local/share/Red-DiscordBot/data/tsubaki_prod/cogs/CogManager/cogs/padinfo/padinfo.py", line 552, in idsearch
    await self._do_idsearch(ctx, query)
  File "/home/bot/.local/share/Red-DiscordBot/data/tsubaki_prod/cogs/CogManager/cogs/padinfo/padinfo.py", line 570, in _do_idsearch
    await self._do_monster_list(ctx, dbcog, query, queried_props, 'ID Search Results',
  File "/home/bot/.local/share/Red-DiscordBot/data/tsubaki_prod/cogs/CogManager/cogs/padinfo/padinfo.py", line 654, in _do_monster_list
    await parent_menu.transition(message, ims, MonsterListEmoji.refresh, ctx.author, **data)
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discordmenu/embed/menu.py", line 77, in transition
    await remove_reaction(message, emoji_clicked, member.id)
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discordmenu/discord_client.py", line 37, in remove_reaction
    await message.remove_reaction(emoji_cache.get_raw_emoji(emoji), member)
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/message.py", line 1027, in remove_reaction
    await self._state.http.remove_reaction(self.channel.id, self.id, emoji, member.id)
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/http.py", line 512, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 31001): You are being rate limited.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 1232, in invoke
    await ctx.command.invoke(ctx)
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/ext/commands/core.py", line 931, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/ext/commands/core.py", line 196, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 429 Too Many Requests (error code: 31001): You are being rate limited.
I got another rate limit error printed to channel just now (even after rolling back). Here's the traceback: ``` Exception in command 'idsearch' Traceback (most recent call last): File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/ext/commands/core.py", line 187, in wrapped ret = await coro(*args, **kwargs) File "/home/bot/.local/share/Red-DiscordBot/data/tsubaki_prod/cogs/CogManager/cogs/padinfo/padinfo.py", line 552, in idsearch await self._do_idsearch(ctx, query) File "/home/bot/.local/share/Red-DiscordBot/data/tsubaki_prod/cogs/CogManager/cogs/padinfo/padinfo.py", line 570, in _do_idsearch await self._do_monster_list(ctx, dbcog, query, queried_props, 'ID Search Results', File "/home/bot/.local/share/Red-DiscordBot/data/tsubaki_prod/cogs/CogManager/cogs/padinfo/padinfo.py", line 654, in _do_monster_list await parent_menu.transition(message, ims, MonsterListEmoji.refresh, ctx.author, **data) File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discordmenu/embed/menu.py", line 77, in transition await remove_reaction(message, emoji_clicked, member.id) File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discordmenu/discord_client.py", line 37, in remove_reaction await message.remove_reaction(emoji_cache.get_raw_emoji(emoji), member) File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/message.py", line 1027, in remove_reaction await self._state.http.remove_reaction(self.channel.id, self.id, emoji, member.id) File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/http.py", line 512, in request raise HTTPException(response, data) discord.errors.HTTPException: 429 Too Many Requests (error code: 31001): You are being rate limited. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 1232, in invoke await ctx.command.invoke(ctx) File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/ext/commands/core.py", line 931, in invoke await injected(*ctx.args, **ctx.kwargs) # type: ignore File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/ext/commands/core.py", line 196, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 429 Too Many Requests (error code: 31001): You are being rate limited. ```
RheingoldRiver commented 2023-04-17 23:14:14 +02:00 (Migrated from github.com)

I forgot to follow up about this. We revisited the upgrade about a month ago, and at this point Dpy was on 2.2, and the error is totally gone. So we think there was some issue temporarily with async handling of emotes in 1 release of Dpy and at least our error no longer applies. We're now fully caught up in the Red development branch and having no issues, the repro should not be possible anymore.

Not sure if the DM issue is still happening though.

I forgot to follow up about this. We revisited the upgrade about a month ago, and at this point Dpy was on 2.2, and the error is totally gone. So we think there was some issue temporarily with async handling of emotes in 1 release of Dpy and at least our error no longer applies. We're now fully caught up in the Red development branch and having no issues, the repro should not be possible anymore. Not sure if the DM issue is still happening though.
Flame442 commented 2023-04-17 23:19:36 +02:00 (Migrated from github.com)

Yup, seems like the reaction issue has been fixed either in a newer version of dpy or by discord. I can't replicate the DM issue on 3.4.18 anymore either, so it seems like that was a temporary thing as well. Thanks for bumping this.

Yup, seems like the reaction issue has been fixed either in a newer version of dpy or by discord. I can't replicate the DM issue on 3.4.18 anymore either, so it seems like that was a temporary thing as well. Thanks for bumping this.
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#5905
No description provided.