release-bot icon indicating copy to clipboard operation
release-bot copied to clipboard

IndexError: list index out of range with a lot of starred repos

Open GitGitro opened this issue 11 months ago • 1 comments

Hi! i was tinkering with this bot and loving it so far but i encountered an error while adding my starred repos as i have a lot of them. Here is the error:

Traceback (most recent call last):

  File "/usr/local/lib/python3.12/site-packages/telegram/ext/_application.py", line 1325, in process_update

    await coroutine

  File "/usr/local/lib/python3.12/site-packages/telegram/ext/_handlers/basehandler.py", line 158, in handle_update

    return await self.callback(update, context)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/app/app/telegram_bot.py", line 342, in button

    await self.add_starred_repos(chat_id, github_user, update.callback_query.get_bot())

  File "/app/app/telegram_bot.py", line 307, in add_starred_repos

    await self.add_repo(chat_id, repo, bot, True)

  File "/app/app/telegram_bot.py", line 255, in add_repo

    store_latest_release(db.session, repo, repo_obj)

  File "/app/app/repo_engine.py", line 80, in store_latest_release

    prerelease = repo.get_releases()[0]

                 ~~~~~~~~~~~~~~~~~~~^^^

  File "/usr/local/lib/python3.12/site-packages/github/PaginatedList.py", line 77, in __getitem__

    return self.__elements[index]

           ~~~~~~~~~~~~~~~^^^^^^^

IndexError: list index out of range

also maybe a flag to do it silently instead of posting every added repo would a nice to have feature, only a notification when finished. But that's a plus, up to you.

if you need more logs/environment setup etc. feel free to ask. Thank you!

GitGitro avatar Feb 09 '25 22:02 GitGitro

Following up:

maybe i found a fix but i'm not sure, i keep getting timed out errors because the bot sends too many messages at once.

from telegram faqs: In a group, bots are not be able to send more than 20 messages per minute.

So either the silent option i mentioned above or some kind of delay between each message would be really nice to avoid rate limits from telegram

GitGitro avatar Feb 25 '25 22:02 GitGitro