Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TypeError when hitting GitHub rate limits #12

Open
adamchainz opened this issue Feb 19, 2025 · 0 comments
Open

TypeError when hitting GitHub rate limits #12

adamchainz opened this issue Feb 19, 2025 · 0 comments

Comments

@adamchainz
Copy link

I ran gha-update across a bunch of repositories in parallel. It crashed in most of them with:

Traceback (most recent call last):
  File "/Users/chainz/Library/Caches/uv/archive-v0/IGglcEwi1hvWrCa0H9SqU/bin/gha-update", line 12, in <module>
    sys.exit(cli())
             ~~~^^
  File "/Users/chainz/Library/Caches/uv/archive-v0/IGglcEwi1hvWrCa0H9SqU/lib/python3.13/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/chainz/Library/Caches/uv/archive-v0/IGglcEwi1hvWrCa0H9SqU/lib/python3.13/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/Users/chainz/Library/Caches/uv/archive-v0/IGglcEwi1hvWrCa0H9SqU/lib/python3.13/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chainz/Library/Caches/uv/archive-v0/IGglcEwi1hvWrCa0H9SqU/lib/python3.13/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/Users/chainz/Library/Caches/uv/archive-v0/IGglcEwi1hvWrCa0H9SqU/lib/python3.13/site-packages/gha_update/_cli.py", line 21, in cli
    asyncio.run(update_workflows(config))
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chainz/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/Users/chainz/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/Users/chainz/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/Users/chainz/Library/Caches/uv/archive-v0/IGglcEwi1hvWrCa0H9SqU/lib/python3.13/site-packages/gha_update/_core.py", line 44, in update_workflows
    versions = await get_versions(actions)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chainz/Library/Caches/uv/archive-v0/IGglcEwi1hvWrCa0H9SqU/lib/python3.13/site-packages/gha_update/_core.py", line 98, in get_versions
    out[name] = highest_version(task.result().json())
                ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chainz/Library/Caches/uv/archive-v0/IGglcEwi1hvWrCa0H9SqU/lib/python3.13/site-packages/gha_update/_core.py", line 104, in highest_version
    items: dict[str, str] = {t["name"]: t["commit"]["sha"] for t in tags}
                             ~^^^^^^^^
TypeError: string indices must be integers, not 'str'

Trying again with the debugging, I could see that tags is the JSON of an error response:

  File "/Users/chainz/Library/Caches/uv/archive-v0/IGglcEwi1hvWrCa0H9SqU/lib/python3.13/site-packages/gha_update/_core.py", line 104, in highest_version
    items: dict[str, str] = {t["name"]: t["commit"]["sha"] for t in tags}
                             ~^^^^^^^^
TypeError: string indices must be integers, not 'str'
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /Users/chainz/Library/Caches/uv/archive-v0/IGglcEwi1hvWrCa0H9SqU/lib/python3.13/site-packages/gha_update/_core.py(104)highest_version()
-> items: dict[str, str] = {t["name"]: t["commit"]["sha"] for t in tags}
(Pdb) tags
{'message': "API rate limit exceeded for 91.109.232.204. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", 'documentation_url': 'https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting'}

I think #11 is a fix.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant