UTF-8 codec error after booting a fresh installation

Hi!

Having a weird utf-8 error after restarting my arch linux (AMD64, kernel 6.5.4-arch2-1) box with a fresh installation of HA (using home-assistant-service-pip). The system ran smoothly for more than one day. After the first reboot of the system this error shows up:

File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/util/json.py", line 74, in load_json raise HomeAssistantError(error) from error
homeassistant.exceptions.HomeAssistantError: 'utf-8' codec can't decode byte 0xfc in position 11701: invalid start byte

Previously I could start and stop the hass.service without problems. Only after a proper reboot this error emerged, and HA eternally tries to restart. Yes, configuration.yaml is in UTF-8 encoding.

Any ideas? Appreciating very much any help. -Mike


Full log (journalctl -fu hass.service):

Sep 26 14:25:51 prometeo systemd[1]: hass.service: Scheduled restart job, restart counter is at 48.
Sep 26 14:26:14 prometeo systemd[1]: Started Home assistant.
Sep 26 14:26:16 prometeo python[2023]: 2023-09-26 14:26:16.847 ERROR (SyncWorker_3) [homeassistant.util.json] Could not parse JSON content: /var/lib/hass/.storage/core.device_registry
Sep 26 14:26:16 prometeo python[2023]: Traceback (most recent call last):
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/util/json.py", line 68, in load_json
Sep 26 14:26:16 prometeo python[2023]:     return orjson.loads(fdesc.read())  # type: ignore[no-any-return]
Sep 26 14:26:16 prometeo python[2023]:                         ^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "<frozen codecs>", line 322, in decode
Sep 26 14:26:16 prometeo python[2023]: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 11701: invalid start byte
Sep 26 14:26:16 prometeo python[2023]: 2023-09-26 14:26:16.857 ERROR (SyncWorker_1) [homeassistant.util.json] Could not parse JSON content: /var/lib/hass/.storage/core.entity_registry
Sep 26 14:26:16 prometeo python[2023]: Traceback (most recent call last):
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/util/json.py", line 68, in load_json
Sep 26 14:26:16 prometeo python[2023]:     return orjson.loads(fdesc.read())  # type: ignore[no-any-return]
Sep 26 14:26:16 prometeo python[2023]:                         ^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "<frozen codecs>", line 322, in decode
Sep 26 14:26:16 prometeo python[2023]: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 8487: invalid start byte
Sep 26 14:26:16 prometeo python[2023]: 2023-09-26 14:26:16.861 ERROR (MainThread) [root] Uncaught exception
Sep 26 14:26:16 prometeo python[2023]: Traceback (most recent call last):
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/util/json.py", line 68, in load_json
Sep 26 14:26:16 prometeo python[2023]:     return orjson.loads(fdesc.read())  # type: ignore[no-any-return]
Sep 26 14:26:16 prometeo python[2023]:                         ^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "<frozen codecs>", line 322, in decode
Sep 26 14:26:16 prometeo python[2023]: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 11701: invalid start byte
Sep 26 14:26:16 prometeo python[2023]: The above exception was the direct cause of the following exception:
Sep 26 14:26:16 prometeo python[2023]: Traceback (most recent call last):
Sep 26 14:26:16 prometeo python[2023]:   File "<frozen runpy>", line 198, in _run_module_as_main
Sep 26 14:26:16 prometeo python[2023]:   File "<frozen runpy>", line 88, in _run_code
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/__main__.py", line 216, in <module>
Sep 26 14:26:16 prometeo python[2023]:     sys.exit(main())
Sep 26 14:26:16 prometeo python[2023]:              ^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/__main__.py", line 204, in main
Sep 26 14:26:16 prometeo python[2023]:     exit_code = runner.run(runtime_conf)
Sep 26 14:26:16 prometeo python[2023]:                 ^^^^^^^^^^^^^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/runner.py", line 186, in run
Sep 26 14:26:16 prometeo python[2023]:     return loop.run_until_complete(setup_and_run_hass(runtime_config))
Sep 26 14:26:16 prometeo python[2023]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
Sep 26 14:26:16 prometeo python[2023]:     return future.result()
Sep 26 14:26:16 prometeo python[2023]:            ^^^^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/runner.py", line 152, in setup_and_run_hass
Sep 26 14:26:16 prometeo python[2023]:     hass = await bootstrap.async_setup_hass(runtime_config)
Sep 26 14:26:16 prometeo python[2023]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/bootstrap.py", line 155, in async_setup_hass
Sep 26 14:26:16 prometeo python[2023]:     await async_from_config_dict(config_dict, hass) is not None
Sep 26 14:26:16 prometeo python[2023]:     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/bootstrap.py", line 269, in async_from_config_dict
Sep 26 14:26:16 prometeo python[2023]:     await load_registries(hass)
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/bootstrap.py", line 246, in load_registries
Sep 26 14:26:16 prometeo python[2023]:     await asyncio.gather(
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/helpers/device_registry.py", line 936, in async_load
Sep 26 14:26:16 prometeo python[2023]:     await hass.data[DATA_REGISTRY].async_load()
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/helpers/device_registry.py", line 777, in async_load
Sep 26 14:26:16 prometeo python[2023]:     data = await self._store.async_load()
Sep 26 14:26:16 prometeo python[2023]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/helpers/storage.py", line 133, in async_load
Sep 26 14:26:16 prometeo python[2023]:     return await self._load_task
Sep 26 14:26:16 prometeo python[2023]:            ^^^^^^^^^^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/helpers/storage.py", line 142, in _async_load
Sep 26 14:26:16 prometeo python[2023]:     return await self._async_load_data()
Sep 26 14:26:16 prometeo python[2023]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/helpers/storage.py", line 161, in _async_load_data
Sep 26 14:26:16 prometeo python[2023]:     data = await self.hass.async_add_executor_job(
Sep 26 14:26:16 prometeo python[2023]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
Sep 26 14:26:16 prometeo python[2023]:     result = self.fn(*self.args, **self.kwargs)
Sep 26 14:26:16 prometeo python[2023]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 26 14:26:16 prometeo python[2023]:   File "/var/lib/hass-installation/lib/python3.11/site-packages/homeassistant/util/json.py", line 74, in load_json
Sep 26 14:26:16 prometeo python[2023]:     raise HomeAssistantError(error) from error
Sep 26 14:26:16 prometeo python[2023]: homeassistant.exceptions.HomeAssistantError: 'utf-8' codec can't decode byte 0xfc in position 11701: invalid start byte
Sep 26 14:26:17 prometeo systemd[1]: hass.service: Main process exited, code=exited, status=1/FAILURE
Sep 26 14:26:17 prometeo systemd[1]: hass.service: Failed with result 'exit-code'.
Sep 26 14:26:17 prometeo systemd[1]: hass.service: Consumed 3.047s CPU time.

Hi, did you solve this back then? I face the same issue right now with the latest version I installed from github, reusing my existing DB. first start: all good. shutdown, 2nd start: same issue.

Pls let me know!