Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

HACS integration failed to set up #2868

Closed
7 tasks done
DAveShillito opened this issue Oct 2, 2022 · 7 comments
Closed
7 tasks done

HACS integration failed to set up #2868

DAveShillito opened this issue Oct 2, 2022 · 7 comments

Comments

@DAveShillito
Copy link

System Health details

## System Information

version | core-2022.9.7
-- | --
installation_type | Home Assistant OS
dev | false
hassio | true
docker | true
user | root
virtualenv | false
python_version | 3.10.5
os_name | Linux
os_version | 5.15.61-v8
arch | aarch64
timezone | Europe/London
config_dir | /config

<details><summary>Home Assistant Community Store</summary>

GitHub API | ok
-- | --
GitHub Content | ok
GitHub Web | ok
GitHub API Calls Remaining | 5000
Installed Version | 1.27.2
Stage | null
Available Repositories | 0
Downloaded Repositories | 0
Disabled | restore

</details>

<details><summary>Home Assistant Cloud</summary>

logged_in | true
-- | --
subscription_expiration | 18 September 2023 at 01:00
relayer_connected | true
remote_enabled | true
remote_connected | true
alexa_enabled | true
google_enabled | true
remote_server | eu-west-2-5.ui.nabu.casa
can_reach_cert_server | ok
can_reach_cloud_auth | ok
can_reach_cloud | ok

</details>

<details><summary>Home Assistant Supervisor</summary>

host_os | Home Assistant OS 9.0
-- | --
update_channel | stable
supervisor_version | supervisor-2022.09.1
agent_version | 1.3.0
docker_version | 20.10.17
disk_total | 109.3 GB
disk_used | 8.1 GB
healthy | true
supported | true
board | rpi4-64
supervisor_api | ok
version_api | ok
installed_addons | ESPHome (2022.9.2), Terminal & SSH (9.6.1), Home Assistant Google Drive Backup (0.108.4), Studio Code Server (5.4.0), File editor (5.4.1), MariaDB (2.5.1), InfluxDB (4.5.0), Grafana (8.0.2)

</details>

<details><summary>Dashboards</summary>

dashboards | 2
-- | --
resources | 0
views | 3
mode | storage

</details>

<details><summary>Recorder</summary>

oldest_recorder_run | 25 September 2022 at 02:24
-- | --
current_recorder_run | 2 October 2022 at 12:34
estimated_db_size | 130.36 MiB
database_engine | mysql
database_version | 10.6.8

</details>

Checklist

Describe the issue

I followed the instal instructions on https://hacs.xyz/docs/configuration/basic
I successfully activated on GitHub, but when I returned to the integration page I saw the following.
Image01
Following the link to the logs I saw...
Image02


Full logs
2022-10-02 12:33:59.920 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-10-02 14:51:25.917 ERROR (SyncWorker_2) [homeassistant.util.json] Could not parse JSON content: /config/.storage/hacs.repositories
2022-10-02 14:51:25.923 ERROR (MainThread) [custom_components.hacs] Could not read /config/.storage/hacs.repositories, restore the file from a backup - unexpected control character in string: line 109 column 67 (char 3503)
2022-10-02 14:51:25.926 ERROR (MainThread) [custom_components.hacs] HACS is disabled - HacsDisabledReason.RESTORE

Turning on debugging in hacs added to that log

Full logs
2022-10-02 12:33:59.920 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-10-02 14:51:25.917 ERROR (SyncWorker_2) [homeassistant.util.json] Could not parse JSON content: /config/.storage/hacs.repositories
2022-10-02 14:51:25.923 ERROR (MainThread) [custom_components.hacs] Could not read /config/.storage/hacs.repositories, restore the file from a backup - unexpected control character in string: line 109 column 67 (char 3503)
2022-10-02 14:51:25.926 ERROR (MainThread) [custom_components.hacs] HACS is disabled - HacsDisabledReason.RESTORE
2022-10-02 15:06:25.978 ERROR (SyncWorker_5) [homeassistant.util.json] Could not parse JSON content: /config/.storage/hacs.repositories
2022-10-02 15:06:25.982 ERROR (MainThread) [custom_components.hacs] Could not read /config/.storage/hacs.repositories, restore the file from a backup - unexpected control character in string: line 109 column 67 (char 3503)
2022-10-02 15:06:25.983 ERROR (MainThread) [custom_components.hacs] HACS is disabled - HacsDisabledReason.RESTORE
2022-10-02 15:12:31.217 ERROR (SyncWorker_4) [homeassistant.util.json] Could not parse JSON content: /config/.storage/hacs.repositories
2022-10-02 15:12:31.220 ERROR (MainThread) [custom_components.hacs] Could not read /config/.storage/hacs.repositories, restore the file from a backup - unexpected control character in string: line 109 column 67 (char 3503)
2022-10-02 15:12:31.221 ERROR (MainThread) [custom_components.hacs] HACS is disabled - HacsDisabledReason.RESTORE
2022-10-02 15:13:04.868 ERROR (SyncWorker_3) [homeassistant.util.json] Could not parse JSON content: /config/.storage/hacs.repositories
2022-10-02 15:13:04.905 ERROR (SyncWorker_0) [homeassistant.util.json] Could not parse JSON content: /config/.storage/hacs.repositories
File "/config/custom_components/hacs/__init__.py", line 262, in async_reload_entry
File "/config/custom_components/hacs/__init__.py", line 237, in async_unload_entry
await hacs.data.async_write(force=True)
File "/config/custom_components/hacs/utils/data.py", line 83, in async_write
File "/config/custom_components/hacs/utils/data.py", line 93, in _async_store_content_and_repos
await async_save_to_store(self.hacs.hass, "repositories", self.content)
File "/config/custom_components/hacs/utils/store.py", line 62, in async_save_to_store
File "/config/custom_components/hacs/utils/store.py", line 49, in async_load_from_store
File "/config/custom_components/hacs/__init__.py", line 262, in async_reload_entry
File "/config/custom_components/hacs/__init__.py", line 237, in async_unload_entry
await hacs.data.async_write(force=True)
File "/config/custom_components/hacs/utils/data.py", line 83, in async_write
File "/config/custom_components/hacs/utils/data.py", line 93, in _async_store_content_and_repos
await async_save_to_store(self.hacs.hass, "repositories", self.content)
File "/config/custom_components/hacs/utils/store.py", line 62, in async_save_to_store
File "/config/custom_components/hacs/utils/store.py", line 49, in async_load_from_store

Looking at "/config/.storage/hacs.repositories" line 109 column 67

This appears to be a '^' character in "etag_repository". Is this not allowed?

    "169460975": {
      "repository_manifest": {},
      "authors": [
        "@akasma74"
      ],
      "category": "integration",
      "description": "It is a fork of \"Yet another take on a home assistant custom alarm\" that will exist until its autho>
      "domain": "bwalarm",
      "etag_repository": "W/\"10615c3f04fbb78682b25d5599d0895f2a37^@d6744cd57923d97f8c3aa0e50d3\"",
      "full_name": "akasma74/Hass-Custom-Alarm",
      "last_updated": "2022-04-29T16:36:33Z",
      "stargazers_count": 79,
      "last_fetched": 1656859035.199773
    },

Reproduction steps

  1. Follow install instructions
  2. Restart Home Assistant
  3. Look at integrations page.

Debug logs

Full logs
2022-10-02 12:33:59.920 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-10-02 14:51:25.917 ERROR (SyncWorker_2) [homeassistant.util.json] Could not parse JSON content: /config/.storage/hacs.repositories
2022-10-02 14:51:25.923 ERROR (MainThread) [custom_components.hacs] Could not read /config/.storage/hacs.repositories, restore the file from a backup - unexpected control character in string: line 109 column 67 (char 3503)
2022-10-02 14:51:25.926 ERROR (MainThread) [custom_components.hacs] HACS is disabled - HacsDisabledReason.RESTORE
2022-10-02 15:06:25.978 ERROR (SyncWorker_5) [homeassistant.util.json] Could not parse JSON content: /config/.storage/hacs.repositories
2022-10-02 15:06:25.982 ERROR (MainThread) [custom_components.hacs] Could not read /config/.storage/hacs.repositories, restore the file from a backup - unexpected control character in string: line 109 column 67 (char 3503)
2022-10-02 15:06:25.983 ERROR (MainThread) [custom_components.hacs] HACS is disabled - HacsDisabledReason.RESTORE
2022-10-02 15:12:31.217 ERROR (SyncWorker_4) [homeassistant.util.json] Could not parse JSON content: /config/.storage/hacs.repositories
2022-10-02 15:12:31.220 ERROR (MainThread) [custom_components.hacs] Could not read /config/.storage/hacs.repositories, restore the file from a backup - unexpected control character in string: line 109 column 67 (char 3503)
2022-10-02 15:12:31.221 ERROR (MainThread) [custom_components.hacs] HACS is disabled - HacsDisabledReason.RESTORE
2022-10-02 15:13:04.868 ERROR (SyncWorker_3) [homeassistant.util.json] Could not parse JSON content: /config/.storage/hacs.repositories
2022-10-02 15:13:04.905 ERROR (SyncWorker_0) [homeassistant.util.json] Could not parse JSON content: /config/.storage/hacs.repositories
File "/config/custom_components/hacs/__init__.py", line 262, in async_reload_entry
File "/config/custom_components/hacs/__init__.py", line 237, in async_unload_entry
await hacs.data.async_write(force=True)
File "/config/custom_components/hacs/utils/data.py", line 83, in async_write
File "/config/custom_components/hacs/utils/data.py", line 93, in _async_store_content_and_repos
await async_save_to_store(self.hacs.hass, "repositories", self.content)
File "/config/custom_components/hacs/utils/store.py", line 62, in async_save_to_store
File "/config/custom_components/hacs/utils/store.py", line 49, in async_load_from_store
File "/config/custom_components/hacs/__init__.py", line 262, in async_reload_entry
File "/config/custom_components/hacs/__init__.py", line 237, in async_unload_entry
await hacs.data.async_write(force=True)
File "/config/custom_components/hacs/utils/data.py", line 83, in async_write
File "/config/custom_components/hacs/utils/data.py", line 93, in _async_store_content_and_repos
await async_save_to_store(self.hacs.hass, "repositories", self.content)
File "/config/custom_components/hacs/utils/store.py", line 62, in async_save_to_store
File "/config/custom_components/hacs/utils/store.py", line 49, in async_load_from_store

Diagnostics dump

There is no option to dump diagnostics, I assume since the integration has failed to start.
Image03

@DAveShillito DAveShillito added the issue:backend For issues with the backend/integration label Oct 2, 2022
@hacs-bot
Copy link

hacs-bot bot commented Oct 2, 2022

Make sure you have read the issue guidelines and that you filled out the entire template.

If you have an issue identical to this, do not add comments like "same here", "i have this too", instead add a 👍 reaction to the issue description. Thanks! 👍

@ludeeus ludeeus added Issue not in HACS and removed issue:backend For issues with the backend/integration labels Oct 2, 2022
@ludeeus
Copy link
Member

ludeeus commented Oct 2, 2022

^ is fine, its still within a string, eEnding like this however: until its autho> is not fine.
Resore that file from backup and it will start properly again.

You should also look into replacing your storage media, this is a sign it's starting to go bad.

@ludeeus ludeeus closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2022
@DAveShillito
Copy link
Author

DAveShillito commented Oct 2, 2022

This is the first time I have ever installed HACS, so I have no backups, this is just as came down from the repro.
The whole HA install is new, I have only had it up a few months and it is running off a new SSD.

@DAveShillito
Copy link
Author

Sorry I made an error copying that section of the JSON from Putty, which explains the truncation
The full block is

    "169460975": {
      "repository_manifest": {},
      "authors": [
        "@akasma74"
      ],
      "category": "integration",
      "description": "It is a fork of \"Yet another take on a home assistant custom alarm\" that will exist until its author is back to our Earth",
      "domain": "bwalarm",
      "etag_repository": "W/\"10615c3f04fbb78682b25d5599d0895f2a37^@d6744cd57923d97f8c3aa0e50d3\"",
      "full_name": "akasma74/Hass-Custom-Alarm",
      "last_updated": "2022-04-29T16:36:33Z",
      "stargazers_count": 79,
      "last_fetched": 1656859035.199773
    },

@ludeeus
Copy link
Member

ludeeus commented Oct 2, 2022

Remove the file completely then, since you have not using it

@DAveShillito
Copy link
Author

I removed the file, restarted HA.
The file was recreated, but a diff shows it is not the same as previous.

I still have a "Failed to set up" message, but one service and one entity are now listed.

Image05

Looking at the logs I now have

2022-10-02 15:55:24.474 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-10-02 15:55:39.979 ERROR (MainThread) [custom_components.hacs] HACS is disabled - HacsDisabledReason.RATE_LIMIT
2022-10-02 15:57:04.369 ERROR (MainThread) [custom_components.hacs] HACS is disabled - HacsDisabledReason.RATE_LIMIT
2022-10-02 15:57:19.821 ERROR (MainThread) [custom_components.hacs] HACS is disabled - HacsDisabledReason.RATE_LIMIT

However HACS does now display in the sidebar with a useful warning

Image04

So I will wait a few hours to see if everything has been fixed, or if the original error returns.
Thanks for the help :)

@DAveShillito
Copy link
Author

I can confirm that deleting "/config/.storage/hacs.repositories", restarting and allowing it to regenerate, then waiting for the rate limit to be cleared has fixed the issue.
Thanks again @ludeeus 😄

@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants