home-assistant/core · warning · UpdateFailed

Unable to fetch data for migration: {err}

Error message

Unable to fetch data for migration: {err}

What it means

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.

Source

Thrown at homeassistant/components/airthings_ble/coordinator.py:84

                translation_domain=DOMAIN,
                translation_key="device_not_found",
                translation_placeholders={
                    "address": address,
                    "reason": bluetooth.async_address_reachability_diagnostics(
                        self.hass,
                        address.upper(),
                        BluetoothReachabilityIntent.CONNECTION,
                    ),
                },
            )
        self.ble_device = ble_device

        if DEVICE_MODEL not in self.config_entry.data:
            _LOGGER.debug("Fetching device info for migration")
            try:
                data = await self.airthings.update_device(self.ble_device)
            except Exception as err:
                raise UpdateFailed(
                    f"Unable to fetch data for migration: {err}"
                ) from err

            self.hass.config_entries.async_update_entry(
                self.config_entry,
                data={**self.config_entry.data, DEVICE_MODEL: data.model.value},
            )
            self.update_interval = timedelta(
                seconds=DEVICE_SPECIFIC_SCAN_INTERVAL.get(
                    data.model.value, DEFAULT_SCAN_INTERVAL
                )
            )

    @override
    async def _async_update_data(self) -> AirthingsDevice:
        """Get data from Airthings BLE."""
        try:
            data = await self.airthings.update_device(self.ble_device)

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Move the device closer or improve the Bluetooth proxy placement and retry setup.
  2. Press the device's button to wake it before retrying.
  3. Replace the battery — weak batteries cause dropped GATT connections.
  4. Remove and re-add the config entry if the legacy migration is not needed (re-setup stores the model directly).
  5. Check the wrapped err in logs to distinguish timeout vs encryption errors.
Defensive patterns

Strategy: retry

Type guard

def is_airthings_ble_migration_failed(err: Exception) -> bool:
    return isinstance(err, UpdateFailed) and str(err).startswith("Unable to fetch data for migration")

Try / catch

try:
    await coordinator.async_config_entry_first_refresh()
except (ConfigEntryNotReady, UpdateFailed) as err:
    if "for migration" in str(err):
        # one-time legacy migration failed: wake/pair device, reload entry to retry migration
        await hass.config_entries.async_reload(entry.entry_id)

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14). Data as JSON: /api/errors/10489fbe2686882e. Report an issue: GitHub.