integration: Failed after snapshot restoration

System Health details

System Health

version core-2021.8.8
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.6
os_name Linux
os_version 5.10.53
arch x86_64
timezone Australia/Melbourne
Home Assistant Cloud
logged_in true
subscription_expiration September 1, 2021, 10:00
relayer_connected true
remote_enabled true
remote_connected true
alexa_enabled false
google_enabled true
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 6.2
update_channel stable
supervisor_version supervisor-2021.06.8
docker_version 20.10.6
disk_total 30.8 GB
disk_used 4.4 GB
healthy true
supported true
board ova
supervisor_api ok
version_api ok
installed_addons SSH & Web Terminal (9.0.1), File editor (5.3.3), Home Assistant Google Drive Backup (0.104.3), Check Home Assistant configuration (3.8.0), Mosquitto broker (6.0.1)
Lovelace
dashboards 1
resources 4
views 7
mode storage

Checklist

  • I’m running the newest version of HACS https://github.com/hacs/integration/releases/latest
  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • I have read https://hacs.xyz/docs/issues
  • This issue is related to the backend (integration part) of HACS.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).

Describe the issue

Hi there,

I recently had to restore my Home Assistant OS install from a full snapshot.

At the time of writing, I’m using the latest version of Home Assion OS installed into a Virtual Box environment on Windows 10.

When HA came back online after the restoration, the HACS icon had disappeared from my quick access panel on the left of the screen.

I checked the HACS entry on the integration page and it says “! Not loaded” in the description.

So I searched high and low for a solution, finding lots of threads where users had similar problems but none of their suggestions have worked for me. DISCLAIMER: I am very new to Home Assistant with limited understanding of coding.

I really like HACS and would appreciate it if someone could help me to get it up and running again. Here is what I’ve tried so far:

-the error that shows on boot of HA regarding HACS is the following:

Logger: homeassistant.setup
Source: setup.py:173
First occurred: 03:02:52 (1 occurrences)
Last logged: 03:02:52

Setup failed for hacs: Unable to import component: cannot import name 'ACCEPT_HEADERS' from 'aiogithubapi.common.const' (/usr/local/lib/python3.9/site-packages/aiogithubapi/common/const.py)

-I followed the instructions on this page to remove the integration: https://hacs.xyz/docs/installation/remove -I am a recent HA adopter so there was nothing in config -when I click delete on the HACS integration in the UI, nothing happens - instead, I get the following error in my log:

This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/hacs/const.py:2
Integration: HACS (documentation, issues)
First occurred: 08:04:02 (1 occurrences)
Last logged: 08:04:02

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 70, in delete
    result = await hass.config_entries.async_remove(entry_id)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 809, in async_remove
    await entry.async_remove(self.hass)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 467, in async_remove
    component = integration.get_component()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 490, in get_component
    cache[self.domain] = importlib.import_module(self.pkg_path)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/hacs/__init__.py", line 9, in <module>
    from .const import DOMAIN
  File "/config/custom_components/hacs/const.py", line 2, in <module>
    from aiogithubapi.common.const import ACCEPT_HEADERS
ImportError: cannot import name 'ACCEPT_HEADERS' from 'aiogithubapi.common.const' (/usr/local/lib/python3.9/site-packages/aiogithubapi/common/const.py)

*** the above happened no matter how many times I restarted HA or whether or not I had clicked Disable on the integration (which seems to work as it shows as Disabled) -I tried at this point to delete the custom_components folder using the File Editor add-on (with the integration both disabled or enabled) but it gave me the following error (both times)

ee1b06a362c0e66db2c899a03806014ff7e87be9_2_690x122

-so I tried renaming the hacs folder in custom_components to “temp_hacs” and then used the following command in the terminal to reinstall HACS:

wget -q -O - https://install.hacs.xyz | bash -

-this showed as successfully installing HACS so I restarted Home Assistant but alas the same thing happened and now I am stuck having tried all of the above without success

My wondering is why can I not use the File Editor to delete the folder in custom_components? And why is nothing happening when I click delete on the integration in the UI?

I’ve tried to include as much information as possible here but please let me know if you need anything extra.

Many thanks :slight_smile:

Reproduction steps

Please see issue description for greater detail.

  1. restored from full snapshot
  2. HACS did not load upon restoration
  3. tried to follow the HACS removal instruction but could not complete the delete action OR delete the folder in custom components
  4. renamed HACS folder in custom components so I could reinstall using the command for install in terminal
  5. install seemed to work fine but still can’t use or remove HACS

Debug logs

Logger: homeassistant.setup
Source: setup.py:173
First occurred: 03:02:52 (1 occurrences)
Last logged: 03:02:52

Setup failed for hacs: Unable to import component: cannot import name 'ACCEPT_HEADERS' from 'aiogithubapi.common.const' (/usr/local/lib/python3.9/site-packages/aiogithubapi/common/const.py)
This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/hacs/const.py:2
Integration: HACS (documentation, issues)
First occurred: 08:04:02 (1 occurrences)
Last logged: 08:04:02

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 70, in delete
    result = await hass.config_entries.async_remove(entry_id)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 809, in async_remove
    await entry.async_remove(self.hass)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 467, in async_remove
    component = integration.get_component()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 490, in get_component
    cache[self.domain] = importlib.import_module(self.pkg_path)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/hacs/__init__.py", line 9, in <module>
    from .const import DOMAIN
  File "/config/custom_components/hacs/const.py", line 2, in <module>
    from aiogithubapi.common.const import ACCEPT_HEADERS
ImportError: cannot import name 'ACCEPT_HEADERS' from 'aiogithubapi.common.const' (/usr/local/lib/python3.9/site-packages/aiogithubapi/common/const.py)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

Either way, thanks so much for your help. Your instructions were very clear and easy to follow for a noob 😃

ha core rebuild