HACS can fail to load when system_health_info() returns an unexpected exception #1808
Closed
6 tasks done
Labels
issue:backend
For issues with the backend/integration
Installation details
Checklist
Describe the issue
When HACS starts up, in
async_hacs_startup()
inhacs/operational/setup.py
thesystem_health_info()
function that's called can return an unexpected Exception which causes the HACS loading to fail. When this occurs, the/hacsfiles/
URL path doesn't work, so Lovelace UI elements using custom components don't display. There may be other consequences, too.In my particular case, a
yaml.parser.ParserError
can be returned when the lovelace configuration YAML has severe errors within it. The cause of these YAML errors is due to a race condition of when thehass-lovelace_gen
component is loaded.I use the lovelace_gen extension to allow jinja2 templates within the lovelace configuration. Before that extension is loaded, the actual jinja2 template expressions are exposed to the YAML parser directly causing much unhappiness. Of course, once the extension has started the jinja2 templates are evaluated before the YAML parser has a chance to see them.
To be clear, this race condition isn't the bug that I'm reporting. I'm hoping that a change can be made in
async_hacs_startup()
to be less picky about specific exceptions that are caught. If that's done, HACS can assume that yaml mode is in effect (which is the case) and continue to successfully load. This is just a workaround since there is no dependency or sequencing apparently at work for how custom_components are loaded.I did make this change:
which seems to work around the problem for me. I would be the first to admit this is a crude solution.
Steps to reproduce
summary.yaml.txt
I don't believe that you'd need to install the lovelace_gen extension, since the error occurs before it launches.
Debug logs
I believe this is the relevant part of the log that was generated
Logs
The text was updated successfully, but these errors were encountered: