core: ZHA integration is not starting after updating to core-2022.5.0

The problem

I have updated to the version core-2022.5.0 and got an error:

Logger: homeassistant.config_entries
Source: components/zha/core/gateway.py:182
First occurred: 09:19:36 (1 occurrences)
Last logged: 09:19:36

Error setting up entry ConBee II, s/n: *********** - dresden elektronik ingenieurtechnik GmbH for zha
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 335, in async_setup
result = await component.async_setup_entry(hass, self)
File "/usr/src/homeassistant/homeassistant/components/zha/init.py", line 102, in async_setup_entry
await zha_gateway.async_initialize()
File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 182, in async_initialize
self.application_controller = await app_controller_cls.new(
File "/usr/local/lib/python3.9/site-packages/zigpy/application.py", line 61, in new
await app._load_db()
File "/usr/local/lib/python3.9/site-packages/zigpy/application.py", line 50, in _load_db
self._dblistener = await zigpy.appdb.PersistingListener.new(database_file, self)
File "/usr/local/lib/python3.9/site-packages/zigpy/appdb.py", line 148, in new
await listener.initialize_tables()
File "/usr/local/lib/python3.9/site-packages/zigpy/appdb.py", line 135, in initialize_tables
await self._run_migrations()
File "/usr/local/lib/python3.9/site-packages/zigpy/appdb.py", line 697, in _run_migrations
await migration()
File "/usr/local/lib/python3.9/site-packages/zigpy/appdb.py", line 897, in _migrate_to_v8
await self._migrate_tables(
File "/usr/local/lib/python3.9/site-packages/zigpy/appdb.py", line 737, in _migrate_tables
await self.execute(
File "/usr/local/lib/python3.9/site-packages/aiosqlite/core.py", line 184, in execute
cursor = await self._execute(self._conn.execute, sql, parameters)
File "/usr/local/lib/python3.9/site-packages/aiosqlite/core.py", line 129, in _execute
return await future
File "/usr/local/lib/python3.9/site-packages/aiosqlite/core.py", line 102, in run
result = function()
sqlite3.IntegrityError: UNIQUE constraint failed: attributes_cache_v8.ieee, attributes_cache_v8.endpoint_id, attributes_cache_v8.cluster, attributes_cache_v8.attrid

ZHA is not starting after update, can you please help me to fix the issue?

If i’m downgrading to the previous version every thing is working fine, but i have this error:

SQLite database file is corrupted! *** in database main *** Page 158 is never used wrong # of entries in index neighbors_idx_v7 row 85 missing from index attributes_idx_v7 wrong # of entries in index attributes_idx_v7

My be i need to fix it before upgrading? Do you have any instructions how to fix it?

What version of Home Assistant Core has the issue?

core-2022.5.0

What was the last working version of Home Assistant Core?

core -2022.4.7

What type of installation are you running?

Home Assistant OS

Integration causing the issue

ZHA integration

Link to integration documentation on our website

No response

Diagnostics information

Logger: homeassistant.config_entries
Source: components/zha/core/gateway.py:182
First occurred: 09:19:36 (1 occurrences)
Last logged: 09:19:36

Error setting up entry ConBee II, s/n: DE2128392 - dresden elektronik ingenieurtechnik GmbH for zha
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 335, in async_setup
result = await component.async_setup_entry(hass, self)
File "/usr/src/homeassistant/homeassistant/components/zha/init.py", line 102, in async_setup_entry
await zha_gateway.async_initialize()
File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 182, in async_initialize
self.application_controller = await app_controller_cls.new(
File "/usr/local/lib/python3.9/site-packages/zigpy/application.py", line 61, in new
await app._load_db()
File "/usr/local/lib/python3.9/site-packages/zigpy/application.py", line 50, in _load_db
self._dblistener = await zigpy.appdb.PersistingListener.new(database_file, self)
File "/usr/local/lib/python3.9/site-packages/zigpy/appdb.py", line 148, in new
await listener.initialize_tables()
File "/usr/local/lib/python3.9/site-packages/zigpy/appdb.py", line 135, in initialize_tables
await self._run_migrations()
File "/usr/local/lib/python3.9/site-packages/zigpy/appdb.py", line 697, in _run_migrations
await migration()
File "/usr/local/lib/python3.9/site-packages/zigpy/appdb.py", line 897, in _migrate_to_v8
await self._migrate_tables(
File "/usr/local/lib/python3.9/site-packages/zigpy/appdb.py", line 737, in _migrate_tables
await self.execute(
File "/usr/local/lib/python3.9/site-packages/aiosqlite/core.py", line 184, in execute
cursor = await self._execute(self._conn.execute, sql, parameters)
File "/usr/local/lib/python3.9/site-packages/aiosqlite/core.py", line 129, in _execute
return await future
File "/usr/local/lib/python3.9/site-packages/aiosqlite/core.py", line 102, in run
result = function()
sqlite3.IntegrityError: UNIQUE constraint failed: attributes_cache_v8.ieee, attributes_cache_v8.endpoint_id, attributes_cache_v8.cluster, attributes_cache_v8.attrid

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
  • Comments: 17 (6 by maintainers)

Most upvoted comments

did you recieve my mail to you?

I’ve posted a link to detailed instructions for how to fix your problem. If there’s a specific issue you’re having following them, leave a comment.