Note: After some investigation, I've rewritten this initial post with the latest… findings. You can find the original text further below.
## Steps to reproduce
1. Make sure you don't have any `lovelace` entry in your `configuration.yaml`.
* In other words, that means the default configuration for Lovelace.
* This also means Lovelace dashboards are configured from the web UI.
* If you check System Health (at `/config/info`), it will show the *Lovelace mode* as `auto-gen`.
2. Go to `/hacs/frontend`.
3. Click on `+`, search for any card.
4. Install it.
5. Observe it doesn't work. No error message, no warning.
6. Try to reinstall it. Still doesn't work.
7. Alternatively, find an already installed frontend card and uninstall it. Observe Lovelace will still try to load the removed JavaScript file.
No matter what combination of reboots or clearing cache, lovelace resources aren't updated by HACS.
## Reason
[When there is no explicit `lovelace` configuration, Home Assistant will return lovelace mode as `auto-gen`](https://github.com/hacs/integration/issues/1659#issuecomment-729235484), [while behaving like `storage`](https://github.com/home-assistant/core/commit/e2cc1564a0d1427ac10547099a637a8e9b32ddf7).
Before May 2020, HACS would auto-update lovelace resources if the mode was `!== "yaml"`. After May 2020, [HACS behavior was changed to only update lovelace resources if mode was `=== "storage"`](https://github.com/hacs/integration/issues/259e47f0008a78ebe1c84f2bd3543bb67ddde8a6). This was done [to fix some other issues](https://github.com/hacs/integration/issues/1659#issuecomment-729240583).
So, you can consider this issue a REGRESSION.
## Impact
Out-of-the-box, installing front-end modules through HACS is broken/incomplete: After clicking (re)install, a user would expect to have it fully installed and ready to use. However, that's not the case anymore.
On a basic/default/empty lovelace configuration (I believe most users start out like that), HACS will no longer update lovelace resources, leading to frustration, confusion, extra manual work (which kind of defeats the purpose of HACS). This is specially confusing for users updating from an earlier version (when things "just worked") to a later version.
Potentially related issues:
* #1234
* #1508
* #1529
* [*Starting with 1.0.0 it will handle the resources atomagically if you manage those in the UI*](https://community.home-assistant.io/t/moving-from-manual-install-to-hacs-lovelace-custom-cards/198392/8)
## Suggestions
* HACS could update lovelace resources even on `auto-gen` mode.
* This restores the older HACS behavior, and solves this issue for me.
* However, this may cause some other issues. I'm curious to know which other issues, and I wonder if they can be solved in a different way.
* HACS could have a [configuration option](https://hacs.xyz/docs/configuration/options#options) to "Update lovelace resources even on auto-gen mode".
* HACS could have a warning message in `/hacs/frontend` whenever lovelace resources and installed repositories get out-of-sync.
* Similar to <https://hacs.xyz/docs/faq/status_not_loaded>.
* Such message should have action points:
* Either a button to fix the issue automatically (i.e. HACS would add/remove items from lovelace resources).
* Or clear instructions on how to fix it manually. (Either by manually editing the lovelace resources, or by adding a trivial lovelace entry to `configuration.yaml`.)
---
This is the original text from this issue:
## Installation details
| Description | Value |
| -------------------------- | ----- |
| HACS version | 1.6.2 |
| Home Assistant version | 0.117.6 |
| Installation method for HA | HassOS 4.15 |
Running on a Raspberry Pi. The installation is already several months old, and was "gradually" updated over time. (Well, I skipped a few versions because I forgot to update it for a couple of months; but right now it is up-to-date.)
## Checklist
- [x] I'm running the newest version of HACS <https://github.com/hacs/integration/releases/latest>
- [x] I have enabled debug logging for my installation.
- [x] I have filled out the issue template to the best of my ability.
- [x] I have read <https://hacs.xyz/docs/issues>
- [x] This issue is related to the backend of HACS.
- [x] This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
## Describe the issue
Upon (re)installing a frontend component, HACS is not updating the `lovelace_resources` files, and thus the component is never available in the browser.
### Steps to reproduce
1. Go to `/hacs/frontend`.
2. Click on `+`, search for a vacuum card.
3. Install it.
4. Observe it doesn't work, try to reinstall it.
No matter how many times I do it, or if I restart Home Assistant, or if I restart the whole HassOS… The javascript file never gets added to `/config/.storage/lovelace_resources`.
Yes, my lovelace dashboard is custom-built. `fgrep mode /config/.storage/lovelace_dashboards` shows `"mode": "storage"` (twice, because I built two dashboards).
### Some more background info
Weeks ago, I noticed that [`custom-header` component was not available anymore](https://github.com/maykar/custom-header), so I removed it in HACS.
However, upon restarting and observing logs, I noticed messages that Home Assistant was trying to load `custom-header.js`, even though it had been removed through HACS. This was likely the first sign something is wrong. I solved this by manually editing `/config/.storage/lovelace_resources` to remove that item. (Or maybe I asked HACS to reinstall some component, in the belief HACS would regenerate that file from scratch; I don't remember well, it was a while ago.)
Fast-forward to today, and I try to install some vacuum cards through HACS. By looking at the files, I can see those were installed:
```
$ find /config -name '*vacuum*'
/config/www/community/vacuum-card
/config/www/community/vacuum-card/vacuum-card.js.gz
/config/www/community/vacuum-card/vacuum-card.js
/config/www/community/lovelace-xiaomi-vacuum-card
/config/www/community/lovelace-xiaomi-vacuum-card/xiaomi-vacuum-card.js
/config/www/community/lovelace-xiaomi-vacuum-card/vacuum.png
/config/www/community/lovelace-xiaomi-vacuum-card/xiaomi-vacuum-card.js.gz
```
However, they are not referenced in `lovelace_resources`, so the frontend doesn't load them, so I can't use them.
<details>
<summary>Installed frontend components and `lovelace_resources` contents</summary>
```
$ ls -1 /config/www/community/
light-entity-card
lovelace-auto-entities
lovelace-more-info-card
lovelace-multiple-entity-row
lovelace-paper-buttons-row
lovelace-slider-entity-row
lovelace-xiaomi-vacuum-card
mini-graph-card
mini-media-player
rgb-light-card
select-list-card
tv-card
vacuum-card
$ fgrep url /config/.storage/lovelace_resources | sed 's/^\s*//' | sort
"url": "/hacsfiles/custom-header/custom-header.js"
"url": "/hacsfiles/light-entity-card/light-entity-card.js"
"url": "/hacsfiles/lovelace-auto-entities/auto-entities.js"
"url": "/hacsfiles/lovelace-more-info-card/more-info-card.js"
"url": "/hacsfiles/lovelace-multiple-entity-row/multiple-entity-row.js"
"url": "/hacsfiles/lovelace-multiple-entity-row/multiple-entity-row.js"
"url": "/hacsfiles/lovelace-paper-buttons-row/paper-buttons-row.js"
"url": "/hacsfiles/lovelace-slider-entity-row/slider-entity-row.js"
"url": "/hacsfiles/mini-graph-card/mini-graph-card-bundle.js"
"url": "/hacsfiles/mini-media-player/mini-media-player-bundle.js"
"url": "/hacsfiles/select-list-card/select-list-card.js"
$ cat /config/.storage/lovelace_resources
{
"version": 1,
"key": "lovelace_resources",
"data": {
"items": [
{
"id": "928a1d5600534b639e96a039d6fa4612",
"type": "module",
"url": "/hacsfiles/lovelace-slider-entity-row/slider-entity-row.js"
},
{
"id": "37fa1eb9f1e8430091d262f6c668b8c0",
"type": "module",
"url": "/hacsfiles/lovelace-paper-buttons-row/paper-buttons-row.js"
},
{
"id": "95d36cf3de4749d88ecb8b9d267e25e7",
"type": "module",
"url": "/hacsfiles/lovelace-multiple-entity-row/multiple-entity-row.js"
},
{
"id": "b40615860046426b994eaa46db3fcf46",
"type": "module",
"url": "/hacsfiles/lovelace-multiple-entity-row/multiple-entity-row.js"
},
{
"id": "1cfc152bd7d945b88ee083dd3de17a3c",
"type": "module",
"url": "/hacsfiles/light-entity-card/light-entity-card.js"
},
{
"id": "d4b90110dea749daa02ced43f1984796",
"type": "module",
"url": "/hacsfiles/mini-media-player/mini-media-player-bundle.js"
},
{
"id": "4e110c7cf0824d67aeff8e389d445372",
"type": "module",
"url": "/hacsfiles/lovelace-auto-entities/auto-entities.js"
},
{
"id": "2b5f9caea6774e62ba58b1ab8a988ddf",
"type": "module",
"url": "/hacsfiles/mini-graph-card/mini-graph-card-bundle.js"
},
{
"id": "3359b5f383cd4398b07aa7376f3b9cff",
"type": "module",
"url": "/hacsfiles/lovelace-more-info-card/more-info-card.js"
},
{
"id": "8bfe539e305f4123a64fced5e4713f79",
"type": "module",
"url": "/hacsfiles/select-list-card/select-list-card.js"
},
{
"id": "3102bdc061c047a493efe6698ec8d223",
"type": "module",
"url": "/hacsfiles/custom-header/custom-header.js"
}
]
}
}
```
</details>
Now that I pay enough attention, I can see `lovelace_resources` is still referencing the outdated (and removed) `custom-header.js`, is referencing `multiple-entity-row.js` twice, and is not referencing a few other components. So, **somehow it got completely out-of-sync with the installed components**. And I don't know why.
I've also read <https://hacs.xyz/docs/faq/status_not_loaded>, but I don't see any "Not Loaded" message, and I've already tried the *Reinstall* trick. Also, I don't know which YAML configuration file that page is talking about. Also also, I don't think my lovelace is using any yaml file (`fgrep lovelace /config/*.yaml` returns empty).
## Debug logs
JavaScript console is mostly empty (except for warning messages about animations, those are unrelated to this issue).
Backend logs were captured using:
ha core logs | fgrep hacs > logs.txt
<details>
<summary>Logs</summary>
```
2020-11-17 19:00:15 DEBUG (MainThread) [custom_components.hacs.data] Saving data
2020-11-17 19:00:33 DEBUG (MainThread) [custom_components.hacs.api.repository_data] Running install for denysdovhan/vacuum-card
2020-11-17 19:00:33 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Getting repository information
2020-11-17 19:00:33 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running checks against v1.12.0
2020-11-17 19:00:34 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running pre installation steps
2020-11-17 19:00:34 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Pre installation steps completed
2020-11-17 19:00:34 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running installation steps
2020-11-17 19:00:34 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Getting repository information
2020-11-17 19:00:35 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running checks against v1.12.0
2020-11-17 19:00:36 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] vacuum-card.js
2020-11-17 19:00:36 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Downloading vacuum-card.js
2020-11-17 19:00:36 DEBUG (MainThread) [custom_components.hacs.async_download_file] Downloading https://github.com/denysdovhan/vacuum-card/releases/download/v1.12.0/vacuum-card.js
2020-11-17 19:00:37 DEBUG (MainThread) [custom_components.hacs.download.save] Saving /config/www/community/vacuum-card/vacuum-card.js
2020-11-17 19:00:37 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Download of vacuum-card.js completed
2020-11-17 19:00:37 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Installation steps completed
2020-11-17 19:00:37 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running post installation steps
2020-11-17 19:00:37 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Post installation steps completed
2020-11-17 19:00:37 DEBUG (MainThread) [custom_components.hacs.data] Saving data
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving lovelace-slider-entity-row/slider-entity-row.js from /config/www/community/lovelace-slider-entity-row/slider-entity-row.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving lovelace-paper-buttons-row/paper-buttons-row.js from /config/www/community/lovelace-paper-buttons-row/paper-buttons-row.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving lovelace-multiple-entity-row/multiple-entity-row.js from /config/www/community/lovelace-multiple-entity-row/multiple-entity-row.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving lovelace-auto-entities/auto-entities.js from /config/www/community/lovelace-auto-entities/auto-entities.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving mini-media-player/mini-media-player-bundle.js from /config/www/community/mini-media-player/mini-media-player-bundle.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving light-entity-card/light-entity-card.js from /config/www/community/light-entity-card/light-entity-card.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving mini-graph-card/mini-graph-card-bundle.js from /config/www/community/mini-graph-card/mini-graph-card-bundle.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving lovelace-more-info-card/more-info-card.js from /config/www/community/lovelace-more-info-card/more-info-card.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving select-list-card/select-list-card.js from /config/www/community/select-list-card/select-list-card.js.gz
2020-11-17 19:02:28 ERROR (MainThread) [custom_components.hacs.web.category] Tried to serve up '/config/www/community/custom-header/custom-header.js' but it does not exist
2020-11-17 19:09:15 DEBUG (MainThread) [custom_components.hacs] Nothing in the queue
2020-11-17 19:09:23 DEBUG (MainThread) [custom_components.hacs.api.repository] Running uninstall for denysdovhan/vacuum-card
2020-11-17 19:09:23 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Getting repository information
2020-11-17 19:09:23 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running checks against v1.12.0
2020-11-17 19:09:24 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Uninstalling
2020-11-17 19:09:24 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Removing /config/www/community/vacuum-card
2020-11-17 19:09:24 DEBUG (MainThread) [custom_components.hacs.data] Saving data
2020-11-17 19:09:45 DEBUG (MainThread) [custom_components.hacs.api.repository_data] Running install for denysdovhan/vacuum-card
2020-11-17 19:09:45 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Getting repository information
2020-11-17 19:09:45 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running checks against v1.12.0
2020-11-17 19:09:46 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running pre installation steps
2020-11-17 19:09:46 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Pre installation steps completed
2020-11-17 19:09:46 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running installation steps
2020-11-17 19:09:46 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Getting repository information
2020-11-17 19:09:47 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running checks against v1.12.0
2020-11-17 19:09:47 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] vacuum-card.js
2020-11-17 19:09:47 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Downloading vacuum-card.js
2020-11-17 19:09:47 DEBUG (MainThread) [custom_components.hacs.async_download_file] Downloading https://github.com/denysdovhan/vacuum-card/releases/download/v1.12.0/vacuum-card.js
2020-11-17 19:09:48 DEBUG (MainThread) [custom_components.hacs.download.save] Saving /config/www/community/vacuum-card/vacuum-card.js
2020-11-17 19:09:48 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Download of vacuum-card.js completed
2020-11-17 19:09:48 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Installation steps completed
2020-11-17 19:09:48 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running post installation steps
2020-11-17 19:09:48 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Post installation steps completed
2020-11-17 19:09:48 DEBUG (MainThread) [custom_components.hacs.data] Saving data
```
</details>