Setup failed for hacs: Integration not found

I need some help. I have been working on my HA for a year now and so far everything has gone well. I did a reboot yesterday after upgrading to HA 2023-6-0 and after this HACS hasn’t worked again. I got the error: “Setup failed for hacs: Integration not found.
(ERROR) setup.py”.

I have 7 backups in the last month and I have restored the most recent and the oldest and I always have the same error. (??)

I have also tried the following after restoring my last backup (before the upgrade):

  1. Disable all the “custom components” that HACS uses.
  2. Reboot several times: No success. (HACS Not Loaded, Integration not found)
  3. Uninstall HACS as explained in “Remove | HACS” and I have even removed the “token”.
  4. Reinstall HACS again as explained in “Download | HACS
  5. After this, I can’t see HACS in “Settings->Integration->Add-Integrations”. It never shows up. I have waited several hours and done many reboots and cleared the Browser cache. Unsuccessfully.
    Now I don’t have HACS or any of the “custom_components”

The fact that all the backups that I have restored behave the same and have the same error is what I do not understand

I don’t know what else to do, I’m completely lost.
Thanks.

While I can’t help you with HACS necessarily I can tell you that you can re-activate all of your custom components since the only thing HACS does is provide a means to install & remove select custom components.

a custom component acting up won’t affect HACS and HACS won’t affect any custom component.

Once the custom component is installed it interacts directly with your system and aside from providing for the updates, etc for the custom components HACS and the custom components are completely separate.

As a matter of fact you don’t even need HACS at all on your system and you can manually install and update all the custom stuff that HACS has included without it.

Hello,
Thank you very much for the answer, I did not know this functionality. But any clue why all the “custom components” have stopped working at the same time? I have the same problem on all of them:
“Setup failed for mass: Integration not found.
Setup failed for watchman: Integration not found.
Setup failed for smartthinq_sensors: Integration not found.
Setup failed for scheduler: Integration not found.
…”
And what puzzles me the most is that with any backup that I restore the same thing happens!
Regards

have you looked at your custom_components folder to make sure the integration folders still exist?

there may have been a system issue that may have corrupted/deleted that folder.

I don’t do backups with the backup system (I run HA Container and not supervised) so I can’t help you with backup restorations but I would think that a backup should restore everything that was there when the backup was done.

are you running the latest version of HA that was just released or an older version?

Yes, the folder exists. In fact I have deleted the “hacs” folder from “\custom_components\hacs” and re-installed HACS using my “TERM& SSH” as explained in:
“Run the HACS download script: wget -O - https://get.hacs.xyz | bash -”
This script is capable of recreating the HACS folder in the correct place and automatically downloads all HACS files.
I can’t find a way to make all my “custom components” work again. But the rest of HA works fine, so I don’t think it’s a HW problem.
Regards
Rafael.

Hi, I’m running the latest version of HA
Regards

Are all of the other non-working custom integration files also in the custom_components folder as well?

Also you might try rolling back the version HA to the last known working version.

Fixed: After several hours thinking I did the following.
1.- A copy of the entire “custom_components” directory tree.
2.- I deleted the whole tree.
3.- I created a new folder “custom_components”.
4.- I put back in that directory, all the subdirectories.
4.- HA reset

Everything worked again.
It was clear that the “custom_components” folder had something corrupted in the name that was not fixed by restoring the backups.

It was suspicious that everything below had stopped working: HACS and all the other components. When starting HA it couldn’t read from those directories and everything appeared as “not loaded”.

Nice…

3 Likes

glad you figured it out.

This can happen if you somehow got a __init__.py file located inside the custom_components directory, that directory should only have subdirectories, no files at all.

Another thing that can cause this, is if the user running Home Assistant does not have permissions to list/read the custom_components directory (generally only a problem on core/container installations)

2 Likes

Thanks for the info. I had one init.py file under the custom_components directory. I have deleted it now.
Regards

It cost me a lot of gray hairs — before I read your post!!!
Thanks!!!