core: Database migrtion errors & Reboot Loop -- system broken

The problem

After upgrading to 2022.2, my HA is stuck in a reboot loop, where it stays online for a minute or so, gives me notification a database migration has started, reboots and does it all over again. Just upgraded to 2022.3 but that didn’t help

I do have the postgres plugin running, but disabling that also didn’t do much.

Some logs I managed to salvage:

 Logger: homeassistant.components.recorder.util
Source: components/recorder/util.py:88
Integration: Recorder (documentation, issues)
First occurred: 4:56:51 PM (1 occurrences)
Last logged: 4:56:51 PM
Error executing query: (sqlite3.IntegrityError) UNIQUE constraint failed: statistics.metadata_id, statistics.start [SQL: CREATE UNIQUE INDEX ix_statistics_statistic_id_start ON statistics (metadata_id, start)] (Background on this error at: https://sqlalche.me/e/14/gkpj)

2022-03-06 16:57:59 WARNING (Recorder) [homeassistant.components.recorder.migration] Database is about to upgrade. Schema version: 23
2022-03-06 16:57:59 WARNING (Recorder) [homeassistant.components.recorder.migration] Failed to drop index ix_statistics_statistic_id_start from table statistics. Schema Migration will continue; this is not a critical operation
2022-03-06 16:57:59 WARNING (Recorder) [homeassistant.components.recorder.migration] Failed to drop index ix_statistics_short_term_statistic_id_start from table statistics_short_term. Schema Migration will continue; this is not a critical operation
2022-03-06 16:57:59 WARNING (Recorder) [homeassistant.components.recorder.migration] Adding index `ix_statistics_statistic_id_start` to database. Note: this can take several minutes on large databases and slow computers. Please be patient!

2022-03-06 16:58:04 WARNING (MainThread) [homeassistant.helpers.entity] Entity switch.wakeup_fade (<class 'custom_components.nodered.switch.NodeRedSwitch'>) implements device_state_attributes. Please report it to the custom component author.
2022-03-06 16:58:04 WARNING (MainThread) [homeassistant.helpers.entity] Entity sensor.switch_one_click (<class 'custom_components.nodered.sensor.NodeRedSensor'>) implements device_state_attributes. Please report it to the custom component author.
2022-03-06 16:58:04 WARNING (MainThread) [homeassistant.helpers.entity] Entity sensor.switch_two_click (<class 'custom_components.nodered.sensor.NodeRedSensor'>) implements device_state_attributes. Please report it to the custom component author.
2022-03-06 16:58:04 WARNING (MainThread) [homeassistant.helpers.entity] Entity switch.desk_light_lock (<class 'custom_components.nodered.switch.NodeRedSwitch'>) implements device_state_attributes. Please report it to the custom component author.
2022-03-06 16:58:04 WARNING (MainThread) [homeassistant.helpers.entity] Entity switch.wall_light_lock (<class 'custom_components.nodered.switch.NodeRedSwitch'>) implements device_state_attributes. Please report it to the custom component author.
2022-03-06 16:58:04 WARNING (MainThread) [homeassistant.helpers.entity] Entity switch.softbox_light_lock (<class 'custom_components.nodered.switch.NodeRedSwitch'>) implements device_state_attributes. Please report it to the custom component author.
2022-03-06 16:58:04 WARNING (MainThread) [homeassistant.helpers.entity] Entity switch.moms_light_lock (<class 'custom_components.nodered.switch.NodeRedSwitch'>) implements device_state_attributes. Please report it to the custom component author.

2022-03-06 16:58:18 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (sqlite3.IntegrityError) UNIQUE constraint failed: statistics.metadata_id, statistics.start
[SQL: CREATE UNIQUE INDEX ix_statistics_statistic_id_start ON statistics (metadata_id, start)]
(Background on this error at: https://sqlalche.me/e/14/gkpj)
2022-03-06 16:58:25 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0xFFB5:1:0x0006]: async_initialize: all attempts have failed: [DeliveryError('[0xffb5:1:0x0006]: Message send failure'), DeliveryError('[0xffb5:1:0x0006]: Message send failure'), DeliveryError('[0xffb5:1:0x0006]: Message send failure'), DeliveryError('[0xffb5:1:0x0006]: Message send failure')]
2022-03-06 16:58:26 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0xFFB5:1:0x0300]: async_initialize: all attempts have failed: [DeliveryError('[0xffb5:1:0x0300]: Message send failure'), DeliveryError('[0xffb5:1:0x0300]: Message send failure'), DeliveryError('[0xffb5:1:0x0300]: Message send failure'), DeliveryError('[0xffb5:1:0x0300]: Message send failure')]
2022-03-06 16:58:26 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0xFFB5:1:0x0008]: async_initialize: all attempts have failed: [DeliveryError('[0xffb5:1:0x0008]: Message send failure'), DeliveryError('[0xffb5:1:0x0008]: Message send failure'), DeliveryError('[0xffb5:1:0x0008]: Message send failure'), DeliveryError('[0xffb5:1:0x0008]: Message send failure')]
2022-03-06 16:58:27 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0xA787:1:0x0006]: async_initialize: all attempts have failed: [DeliveryError('[0xa787:1:0x0006]: Message send failure'), DeliveryError('[0xa787:1:0x0006]: Message send failure'), DeliveryError('[0xa787:1:0x0006]: Message send failure'), DeliveryError('[0xa787:1:0x0006]: Message send failure')]

What version of Home Assistant Core has the issue?

2022.3

What was the last working version of Home Assistant Core?

2022.1

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 21 (5 by maintainers)

Most upvoted comments

Same error reported by @Davincible for me

Has anyone managed to fix their system?

I haven’t had time to try NGAJean’s suggestion. I ended up reinstalling an older version of home assistant to a different SD card and restoring my system to that. Still has a few missing plugins, but at least my lights are working.