Help with Bluetooth initialisation after most recent update

Hello, Since the latest update i have noticed esphome wont load and the logs pin the issue with a bluetooth something? i dont have any bluetooth set up though. Fresh installing clears the fault until i copy over my complete configuration folder so its definitely an issue in there somewhere.

Any ideas on where to start? i dont particularly want to write my automations from scratch and stupidly dont have any backups

Processing: home-assistant_2023-02-27T23-00-17.690Z.log…
2023-02-27 22:57:44.826 WARNING (Recorder) [homeassistant.components.recorder.util] The system could not validate that the sqlite3 database at //config/home-assistant_v2.db was shutdown cleanly
2023-02-27 22:57:44.961 WARNING (Recorder) [homeassistant.components.recorder.util] Ended unfinished session (id=177 from 2023-02-27 22:17:51.356951)
2023-02-27 22:57:45.129 ERROR (SyncWorker_1) [homeassistant.util.json] Could not parse JSON content: /config/.storage/bluetooth.remote_scanners
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/util/json.py”, line 39, in load_json
return orjson.loads(fdesc.read()) # type: ignore[no-any-return]
orjson.JSONDecodeError: input length is 0: line 1 column 1 (char 0)
2023-02-27 22:57:45.202 ERROR (MainThread) [homeassistant.setup] Error during setup of component bluetooth
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/util/json.py”, line 39, in load_json
return orjson.loads(fdesc.read()) # type: ignore[no-any-return]
orjson.JSONDecodeError: input length is 0: line 1 column 1 (char 0)

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

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/setup.py”, line 256, in _async_setup_component
result = await task
File “/usr/src/homeassistant/homeassistant/components/bluetooth/init.py”, line 173, in async_setup
await bluetooth_storage.async_setup()
File “/usr/src/homeassistant/homeassistant/components/bluetooth/storage.py”, line 33, in async_setup
self._data = await self._store.async_load() or {}
File “/usr/src/homeassistant/homeassistant/helpers/storage.py”, line 117, in async_load
return await self._load_task
File “/usr/src/homeassistant/homeassistant/helpers/storage.py”, line 126, in _async_load
return await self._async_load_data()
File “/usr/src/homeassistant/homeassistant/helpers/storage.py”, line 144, in async_load_data
data = await self.hass.async_add_executor_job(
File “/usr/local/lib/python3.10/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/util/json.py”, line 45, in load_json
raise HomeAssistantError(error) from error
homeassistant.exceptions.HomeAssistantError: input length is 0: line 1 column 1 (char 0)
2023-02-27 22:57:47.601 ERROR (MainThread) [homeassistant.components.webostv] The ‘webostv’ option near /config/configuration.yaml:3 has been removed, please remove it from your configuration
2023-02-27 22:57:47.623 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of esphome. Setup failed for dependencies: bluetooth
2023-02-27 22:57:47.625 ERROR (MainThread) [homeassistant.setup] Setup failed for esphome: (DependencyError(…), ‘Could not setup dependencies: bluetooth’)
2023-02-27 22:57:48.334 WARNING (MainThread) [homeassistant.config_entries] Config entry ‘Home Assistant’ for roku integration not ready yet: Invalid response from API: Error occurred while communicating with device; Retrying in background
2023-02-27 22:57:48.501 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of default_config. Setup failed for dependencies: bluetooth
2023-02-27 22:57:48.503 ERROR (MainThread) [homeassistant.setup] Setup failed for default_config: (DependencyError(…), ‘Could not setup dependencies: bluetooth’)
2023-02-27 22:57:50.622 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of esphome. Setup failed for dependencies: bluetooth
2023-02-27 22:57:50.637 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/discovery_flow.py”, line 71, in async_start
await gather_with_concurrency(
File "/usr/src/homeassistant/homeassistant/util/async
.py", line 201, in gather_with_concurrency
return await gather(
File "/usr/src/homeassistant/homeassistant/util/async
.py", line 199, in sem_task
return await task
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 798, in async_init
flow, result = await task
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 816, in _async_init
flow = await self.async_create_flow(handler, context=context, data=data)
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 922, in async_create_flow
await async_process_deps_reqs(self.hass, self._hass_config, integration)
File “/usr/src/homeassistant/homeassistant/setup.py”, line 381, in async_process_deps_reqs
raise DependencyError(failed_deps)
homeassistant.exceptions.DependencyError: (DependencyError(…), ‘Could not setup dependencies: bluetooth’)
2023-02-27 22:57:50.641 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of esphome. Setup failed for dependencies: bluetooth
2023-02-27 22:57:50.643 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of esphome. Setup failed for dependencies: bluetooth

Blockquote

I had the same problem when I woke up this morning, a lot of my integrations had failed. As I disabled them one by one I finally wound the error that it couldn’t parse the JSON in bluetooth.remote_scanners. I opened it up and found it had garbage data in the file that seemed to have corrupted a dozen or so entries, screenshot below.

Screenshot 2023-03-01 092638

Note the line of NUL, there are 1982 of those on the line. Weird.

I ended up renaming the file, prepending it with old-, and restarted HA. It looks like it was regenerated and everything seems to be working now for me.

1 Like