core: Error while creating backup

Feedback

I have home assistant installed on docker in x86 machine. When I press cerate backup button. I can see in docker logs the following stacktrace

2023-11-02 22:41:00.397 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140355756237888] Error handling message: Unknown error (unknown_error) Emilian from 127.0.0.1 (Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/backup/websocket.py", line 70, in handle_create
    backup = await manager.generate_backup()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/backup/manager.py", line 176, in generate_backup
    raise result
  File "/usr/src/homeassistant/homeassistant/components/zha/backup.py", line 15, in async_pre_backup
    zha_gateway = get_zha_gateway(hass)
                  ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/core/helpers.py", line 446, in get_zha_gateway
    raise ValueError("No gateway object exists")
ValueError: No gateway object exists
2023-11-02 22:42:10.482 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140355756237888] Error handling message: Unknown error (unknown_error) Emilian from 127.0.0.1 (Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/backup/websocket.py", line 70, in handle_create
    backup = await manager.generate_backup()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/backup/manager.py", line 176, in generate_backup
    raise result
  File "/usr/src/homeassistant/homeassistant/components/zha/backup.py", line 15, in async_pre_backup
    zha_gateway = get_zha_gateway(hass)
                  ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/core/helpers.py", line 446, in get_zha_gateway
    raise ValueError("No gateway object exists")
ValueError: No gateway object exists

URL

https://www.home-assistant.io/integrations/zha/ https://www.home-assistant.io/integrations/backup/

Version

2023.10.5

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 18 (4 by maintainers)

Most upvoted comments

In my case, the reason for this error was that I had a zha block lying around in the configuration.yaml file from some previous testing. The integration was not configured as I wasn’t using it, so removing the entry from the configuration file fixed this for me. Maybe the backup platform should catch the raised exception on non-existing gateways?

I have the same error in version 2024.4, and I do not have zha block in my configuration.yaml. What else can I do?

I discovered that the custom integration XiaomiGateway3 might be the cause for me, and it will be fixed soon. https://github.com/AlexxIT/XiaomiGateway3/issues/1323

I have the same error in version 2024.4, and I do not have zha block in my configuration.yaml. What else can I do?

Same here.

Since my latest backup is 2024.2.5, this issue should be related to some config change.

Confirmed on 2023.11.2.