Error during setup of component backup: 'state'

I was trying to figure out why a lamp that I had configured to switch on at sunset was switching itself off after about a half-hour without being told to do so. It turned out that the bulb must’ve been injecting noise that affected both the WiFi and Zigbee smart outlets I tried using it; replacing the bulb fixed it.

Along the way, I tried rolling back my Home Assistant installation (running the image from https://hub.docker.com/r/homeassistant/home-assistant). That didn’t work, and I started getting errors related to the database schema. I then put it back on the current version. The database errors went away, but now the backup integration refuses to run:

Logger: homeassistant.setup
Source: setup.py:425
First occurred: September 23, 2025 at 12:48:49 PM (1 occurrence)
Last logged: September 23, 2025 at 12:48:49 PM

Error during setup of component backup: 'state'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 425, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/backup/__init__.py", line 106, in async_setup
    await backup_manager.async_setup()
  File "/usr/src/homeassistant/homeassistant/components/backup/manager.py", line 381, in async_setup
    stored = await self.store.load()
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/backup/store.py", line 106, in load
    return await self._store.async_load()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/storage.py", line 289, in async_load
    result = await self._async_load()
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/storage.py", line 309, in _async_load
    return await self._async_load_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/storage.py", line 412, in _async_load_data
    stored = await self._async_migrate_func(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        data["version"], data["minor_version"], data["data"]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/components/backup/store.py", line 57, in _async_migrate_func
    if (state := data["config"]["schedule"]["state"]) in ("daily", "never"):
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'state'

I could just wipe out the installation and rebuild as there aren’t that many devices up and running yet (just a Zigbee USB stick, smart outlet, and pushbutton are actively in use), but that would be kinda the “Windows way” to do things. :slight_smile: It looks like the backup integration is trying to do an upgrade on the database, but is failing. Is there something I could clear out in the database to get the backup integration working again?