{"record":{"id":"ea65198e171449d5","repo":"tqdm/tqdm","slug":"creation-rate-limit-try-increasing-mininterval","errorCode":null,"errorMessage":"Creation rate limit: try increasing `mininterval`.","messagePattern":"Creation rate limit: try increasing `mininterval`\\.","errorType":"console","errorClass":"TqdmWarning","httpStatus":null,"severity":"warning","filePath":"tqdm/contrib/discord.py","lineNumber":53,"sourceCode":"        self.channel_id = channel_id\n        self.session = Session()\n        self.text = self.__class__.__name__\n        self.message_id  # pylint: disable=pointless-statement\n\n    @property\n    def message_id(self):\n        if hasattr(self, '_message_id'):\n            return self._message_id  # pylint: disable=access-member-before-definition\n        try:\n            req = self.session.post(\n                f'{self.API}/channels/{self.channel_id}/messages',\n                headers={'Authorization': f'Bot {self.token}', 'User-Agent': self.UA},\n                json={'content': f\"`{self.text}`\"})\n            res = req.json()\n            req.raise_for_status()\n        except Exception as e:\n            if req.status_code == 429:\n                warn(\"Creation rate limit: try increasing `mininterval`.\",\n                     TqdmWarning, stacklevel=2)\n            else:\n                tqdm_auto.write(str(e))\n        else:\n            self._message_id = res['id']\n            return self._message_id\n\n    def write(self, s):\n        \"\"\"Replaces internal `message_id`'s text with `s`.\"\"\"\n        if not s:\n            s = \"...\"\n        s = s.replace('\\r', '').strip()\n        if s == self.text:\n            return  # avoid duplicate message Bot error\n        message_id = self.message_id\n        if message_id is None:\n            return\n        self.text = s","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/tqdm/tqdm/blob/96f2e60e4584cdab57a23602e27043d0465254ad/tqdm/contrib/discord.py#L35-L71","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Increase mininterval, e.g. tqdm(..., mininterval=5) or higher, so POST frequency stays under Discord limits","Reduce update volume with miniters/mininterval combined (post every N items)","Use a dedicated channel per bar and avoid many concurrent discord bars sharing a token","Check your bot for other traffic consuming the shared rate-limit budget"],"exampleFix":"# before\nfor i in tqdm_discord(range(10**7)):\n    ...  # warns: Creation rate limit\n\n# after\nfor i in tqdm_discord(range(10**7), mininterval=10):\n    ...","handlingStrategy":"validation","validationCode":"from tqdm.contrib.discord import tqdm as tqdm_discord\n# keep POST frequency under Discord's per-channel limit\npbar = tqdm_discord(iterable, mininterval=5)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set mininterval >= 5s for Discord bars","Use one channel per bar/token","Combine with miniters to cut message volume on fast loops"],"tags":["tqdm","discord","rate-limit","http-429"],"backgroundTag":"api-rate-limit-exceeded","analyzedSha":"96f2e60e4584cdab57a23602e27043d0465254ad","analyzedAt":"2026-08-28T11:23:10.474Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}