{"record":{"id":"10489fbe2686882e","repo":"home-assistant/core","slug":"unable-to-fetch-data-for-migration-err","errorCode":null,"errorMessage":"Unable to fetch data for migration: {err}","messagePattern":"Unable to fetch data for migration: (.+?)","errorType":"exception","errorClass":"UpdateFailed","httpStatus":null,"severity":"warning","filePath":"homeassistant/components/airthings_ble/coordinator.py","lineNumber":84,"sourceCode":"                translation_domain=DOMAIN,\n                translation_key=\"device_not_found\",\n                translation_placeholders={\n                    \"address\": address,\n                    \"reason\": bluetooth.async_address_reachability_diagnostics(\n                        self.hass,\n                        address.upper(),\n                        BluetoothReachabilityIntent.CONNECTION,\n                    ),\n                },\n            )\n        self.ble_device = ble_device\n\n        if DEVICE_MODEL not in self.config_entry.data:\n            _LOGGER.debug(\"Fetching device info for migration\")\n            try:\n                data = await self.airthings.update_device(self.ble_device)\n            except Exception as err:\n                raise UpdateFailed(\n                    f\"Unable to fetch data for migration: {err}\"\n                ) from err\n\n            self.hass.config_entries.async_update_entry(\n                self.config_entry,\n                data={**self.config_entry.data, DEVICE_MODEL: data.model.value},\n            )\n            self.update_interval = timedelta(\n                seconds=DEVICE_SPECIFIC_SCAN_INTERVAL.get(\n                    data.model.value, DEFAULT_SCAN_INTERVAL\n                )\n            )\n\n    @override\n    async def _async_update_data(self) -> AirthingsDevice:\n        \"\"\"Get data from Airthings BLE.\"\"\"\n        try:\n            data = await self.airthings.update_device(self.ble_device)","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/airthings_ble/coordinator.py#L66-L102","documentation":"UpdateFailed raised during airthings_ble coordinator setup in the one-time migration path: when the config entry predates device-model storage, the integration calls update_device() to learn the model, and any exception during that BLE exchange becomes 'Unable to fetch data for migration: <err>'. This blocks setup until the BLE connection succeeds.","triggerScenarios":"airthings.update_device(ble_device) raises any Exception while reading device info over BLE: connection dropped during GATT session, encryption/authentication failure, device busy, or timeout — happening specifically for legacy entries where DEVICE_MODEL is absent from entry data.","commonSituations":"Upgrading from an older integration version whose entries lack the model field, combined with a flaky BLE link or a device that is asleep between advertisements.","solutions":["Move the device closer or improve the Bluetooth proxy placement and retry setup.","Press the device's button to wake it before retrying.","Replace the battery — weak batteries cause dropped GATT connections.","Remove and re-add the config entry if the legacy migration is not needed (re-setup stores the model directly).","Check the wrapped err in logs to distinguish timeout vs encryption errors."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"def is_airthings_ble_migration_failed(err: Exception) -> bool:\n    return isinstance(err, UpdateFailed) and str(err).startswith(\"Unable to fetch data for migration\")","tryCatchPattern":"try:\n    await coordinator.async_config_entry_first_refresh()\nexcept (ConfigEntryNotReady, UpdateFailed) as err:\n    if \"for migration\" in str(err):\n        # one-time legacy migration failed: wake/pair device, reload entry to retry migration\n        await hass.config_entries.async_reload(entry.entry_id)","preventionTips":["Wake the BLE device immediately before reloading a legacy entry so the migration read succeeds.","Prefer re-adding the device fresh rather than carrying very old config entries across major upgrades."],"tags":["home-assistant","bluetooth","migration","airthings","coordinator"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}