tqdm/tqdm · warning · TqdmWarning

Creation rate limit: try increasing `mininterval`.

Error message

Creation rate limit: try increasing `mininterval`.

What it means

tqdm.contrib.discord posts progress to a Discord channel via a bot; Discord responds HTTP 429 (rate limit) when messages are sent too frequently, and tqdm warns that you should increase mininterval so bar updates are posted less often. The failing POST is swallowed after warning — the Discord message for that update is simply not created.

Source

Thrown at tqdm/contrib/discord.py:53

        self.channel_id = channel_id
        self.session = Session()
        self.text = self.__class__.__name__
        self.message_id  # pylint: disable=pointless-statement

    @property
    def message_id(self):
        if hasattr(self, '_message_id'):
            return self._message_id  # pylint: disable=access-member-before-definition
        try:
            req = self.session.post(
                f'{self.API}/channels/{self.channel_id}/messages',
                headers={'Authorization': f'Bot {self.token}', 'User-Agent': self.UA},
                json={'content': f"`{self.text}`"})
            res = req.json()
            req.raise_for_status()
        except Exception as e:
            if req.status_code == 429:
                warn("Creation rate limit: try increasing `mininterval`.",
                     TqdmWarning, stacklevel=2)
            else:
                tqdm_auto.write(str(e))
        else:
            self._message_id = res['id']
            return self._message_id

    def write(self, s):
        """Replaces internal `message_id`'s text with `s`."""
        if not s:
            s = "..."
        s = s.replace('\r', '').strip()
        if s == self.text:
            return  # avoid duplicate message Bot error
        message_id = self.message_id
        if message_id is None:
            return
        self.text = s

View on GitHub (pinned to 96f2e60e45)

Solutions

  1. Increase mininterval, e.g. tqdm(..., mininterval=5) or higher, so POST frequency stays under Discord limits
  2. Reduce update volume with miniters/mininterval combined (post every N items)
  3. Use a dedicated channel per bar and avoid many concurrent discord bars sharing a token
  4. Check your bot for other traffic consuming the shared rate-limit budget

Example fix

# before
for i in tqdm_discord(range(10**7)):
    ...  # warns: Creation rate limit

# after
for i in tqdm_discord(range(10**7), mininterval=10):
    ...
Defensive patterns

Strategy: validation

Validate before calling

from tqdm.contrib.discord import tqdm as tqdm_discord
# keep POST frequency under Discord's per-channel limit
pbar = tqdm_discord(iterable, mininterval=5)

Prevention

When it happens

Trigger: tqdm(...) with tqdm_class=tqdm.contrib.discord and a mininterval smaller than Discord's per-channel rate limit allows (roughly < ~5 messages/5s per channel), or many bars sharing one channel/token.

Common situations: Fast-updating loops (millions of iterations with mininterval left at 0.1s), multiple bots/bars posting to the same channel, or hitting global bot rate limits under load.

Related errors


AI-assisted analysis of tqdm/tqdm@96f2e60e45 (2026-08-28). Data as JSON: /api/errors/ea65198e171449d5. Report an issue: GitHub.