Github rate limit error HACS

Yep. That did it for me!

I have a fresh install of HACS. After install, it seemed to be in working condition. I did a server restart and now I’m getting

**HACS is disabled (Ratelimited)**
GitHub API calls are ratelimited, this will clear in less than 1 hour.

I added the personal access token, it didn’t work.
I deleted the hacs folder, that didn’t work as well.

now it shows

**HACS is setting up**
HACS is setting up, during this time some information might be missing or incorrect
**HACS is disabled (Ratelimited)**
GitHub API calls are ratelimited, this will clear in less than 1 hour.

Maybe I didn’t enable the necessary permissions when I’m creating the personal access token?
:frowning:

If you reinstall HACS it uses Oauth with Github and no key is needed.

ok, I removed the HACS integration, removed the token, restarted the server, and added the HACS integration again. For a very short time, it showed:

Background tasks pending
Some repositories might not show until this is completed

Now it seems to be fine, just like at the beginning. Now I’m worried it will not work again if I restart the server.

1 Like

Since there is no central “HACS server”, every installation that runsHACS fetches this information from GitHub, it has to get the information about all [default repositories]

To get the information that is needed to show a representation of the repository in HACS, HACS uses the [GitHub API] and when you hit that rate limit, HACS will pause any communication to the GitHub API until the rate limit reset (can take up to one hour).

INFO

For a new setups with HACS, with the current amount of default repositories you will hit that rate limit on the initial startup after downloading HACS. Because of this, HACS will be in a “Starting up” state until it’s done fetching the information for all default repositories

Which in return will cause the initial startup of HACS to take over 1 hour to finish.

1 Like

Hi all,
just remove the map ‘hacs’ inside the .storage map after reboot.
“(samba share access / hidden files activated explorer)”

reboot and your back online.

greets

1 Like

Hmm i runed the code seems that i only have 60 calls per hour availiable, how do u get call limits increase to 5000

I have run into the same kind of issue, fresh install, loading repos, installed first integration, restart of HA and BAM, rate limit. But according to github limit page (https://api.github.com/rate_limit) I am not even hitting the limit, there are like 3 calls used.

But, I have discovered that I dont have any hacs directory in my config/.storage.

Any suggestion on how you guys solved this? Does reverting to YAML configuration pose any issues? Documentation seems to not recommend this approach, but have you ran into any problems using YAML configurations?

I managed to get this to work by hacking at the HACS code.

If you navigate to https://api.github.com/rate_limit, you will see that the github rate limit allows you to send a burst of 60 requests:

""limit":60,"remaining":59"

Keeping that in mind, check out the file custom_components/hacs/base.py. Inside, there’s a function async_can_update, which has the following weird calculation:

if ((limit := response.data.resources.core.remaining or 0) - 1000) >= 15:
    return math.floor((limit - 10) / 1000)
    self.log.error(                                                      
      "GitHub API ratelimited - %s remaining", response.data.resources.core.remaining)                                                                    
    self.disable_hacs(HacsDisabledReason.RATE_LIMIT)                     

So if remaining is not at least 1015, HACS disables itself… I changed “1000” to “10” and HACS started working for me after a restart. Basically, I think HACS is making a faulty assumption about the number of requests users can send in a single burst. At some time it probably used to be > 1015 but now it’s 60!

4 Likes

I was getting that “GitHub Ratelimit error” for many times, but maybe after an hour or so I had a chance and did not get this error, so I could add a custom repository after all.

the rate limit resets every hour so if you hit the 5000 limit HACS will stop trying till the limit is reset . It’s supposed to stop trying if there are less than 1000 calls left. You should only ever see this happen the first time HACS runs.

1 Like

Thanks, David for quick reply and explanation. :medal_sports:

thanks, this is the only thing that worked for me… albeit once, now its back to “Rate Limit Error…”

Logger: homeassistant.config_entries
Source: config_entries.py:335
First occurred: 7:22:41 AM (2 occurrences)
Last logged: 7:22:56 AM

Config entry '' for hacs integration not ready yet: HacsDisabledReason.RATE_LIMIT; Retrying in background

Hi there

i’m totally new to this

i dont have this directory and can you please share how this needs to be done?

thanks

You have to login into your instance (hassio or core in docker i suppose).
Go to the /config/.storage directory.
This dir is always present. be aware of the . in front of the name it is (dot)storage
if you give ls you won’t see it, in the shell give ls -al or cd /config/.storage

I got it working by another way, by adding this to the configuration.yaml

config:
  hacs.disable(HacsDisabledReason.RATE_LIMIT) return True
2 Likes

thanks, this works at least after a restart - but haven’t left it for very long. Here is the corrected two lines

config:
  - hacs.disable(HacsDisabledReason.RATE_LIMIT) return True
2 Likes

Hello Everybody,

new to the HACS component, it looks promising, but like everybody else here, after fresh install I faced the GitHub API calls are ratelimited error… I went to this topic, and I saw different ways to try to fix the issue, but I would not see how to proceed…

sorry, not so technical, but is there any step by step guide on how to fix this error? any help support is much appreciated :slight_smile:

thank you

Wait until the rate limit runs out, should take a couple of hours to fully set up hacs.

3 Likes

worked :slight_smile: thank you