Storage/core.device_registry

Hya,

some how my storage/core.device_registry became faulty, and by starting HA, i get the following:

cat home-assistant.log 
2021-08-12 15:11:27 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration lovelace_gen which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-08-12 15:11:27 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration nodered which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-08-12 15:11:27 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration ble_monitor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-08-12 15:11:27 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration eventsensor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-08-12 15:11:27 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration proof which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-08-12 15:11:27 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-08-12 15:11:27 INFO (MainThread) [homeassistant.setup] Setup of domain logger took 0.0 seconds
2021-08-12 15:11:28 INFO (MainThread) [homeassistant.setup] Setting up recorder
2021-08-12 15:11:28 INFO (MainThread) [homeassistant.setup] Setting up http
2021-08-12 15:11:28 WARNING (Recorder) [homeassistant.components.recorder.util] The system could not validate that the sqlite3 database at //var/homeassistant/.homeassistant/home-assistant_v2.db was shutdown cleanly
2021-08-12 15:11:28 WARNING (Recorder) [homeassistant.components.recorder.util] Ended unfinished session (id=159 from 2021-08-12 18:02:48.775442)
2021-08-12 15:11:28 INFO (MainThread) [homeassistant.setup] Setup of domain recorder took 0.2 seconds
2021-08-12 15:11:28 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.2 seconds
2021-08-12 15:11:28 INFO (MainThread) [homeassistant.setup] Setting up system_log
2021-08-12 15:11:28 INFO (MainThread) [homeassistant.setup] Setup of domain system_log took 0.0 seconds
2021-08-12 15:11:28 ERROR (SyncWorker_6) [homeassistant.util.json] Could not parse JSON content: /var/homeassistant/.homeassistant/.storage/core.device_registry
Traceback (most recent call last):
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/util/json.py", line 32, in load_json
    return json.loads(fdesc.read())  # type: ignore
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 191 column 9 (char 6614)
2021-08-12 15:11:28 ERROR (MainThread) [root] Uncaught exception
Traceback (most recent call last):
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/util/json.py", line 32, in load_json
    return json.loads(fdesc.read())  # type: ignore
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 191 column 9 (char 6614)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/var/homeassistant/bin/hass", line 8, in <module>
    sys.exit(main())
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/__main__.py", line 314, in main
    exit_code = runner.run(runtime_conf)
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/runner.py", line 108, in run
    return asyncio.run(setup_and_run_hass(runtime_config))
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/runner.py", line 94, in setup_and_run_hass
    hass = await bootstrap.async_setup_hass(runtime_config)
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/bootstrap.py", line 129, in async_setup_hass
    await async_from_config_dict(config_dict, hass) is not None
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/bootstrap.py", line 239, in async_from_config_dict
    await _async_set_up_integrations(hass, config)
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/bootstrap.py", line 531, in _async_set_up_integrations
    await asyncio.gather(
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/device_registry.py", line 633, in async_load
    await hass.data[DATA_REGISTRY].async_load()
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/device_registry.py", line 486, in async_load
    data = await self._store.async_load()
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/storage.py", line 108, in async_load
    return await self._load_task
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/storage.py", line 113, in _async_load
    return await self._async_load_data()
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/storage.py", line 127, in _async_load_data
    data = await self.hass.async_add_executor_job(
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/var/homeassistant/lib/python3.8/site-packages/homeassistant/util/json.py", line 38, in load_json
    raise HomeAssistantError(error) from error
homeassistant.exceptions.HomeAssistantError: Expecting value: line 191 column 9 (char 6614)

any way to fix it?

Depends how badly it’s corrupted.
Maybe post it somewhere that we can assess.

i was able to get from my latest backup. solved!

thx for stepping in.