home-assistant/core · error · UpdateFailed

Error while retrieving data: {err}

Error message

Error while retrieving data: {err}

What it means

UpdateFailed raised as the catch-all when the AirVisual Pro node library raises NodeProError for reasons other than authentication or connection loss — typically malformed or unexpected data returned by the unit's Samba interface. The wrapped err text carries the library-level detail.

Source

Thrown at homeassistant/components/airvisual_pro/coordinator.py:76

    @override
    async def _async_update_data(self) -> dict[str, Any]:
        """Get data from the device."""
        try:
            data = await self._node.async_get_latest_measurements()
            data["history"] = {}
            if data["settings"].get("follow_mode") == "device":
                history = await self._node.async_get_history(include_trends=False)
                data["history"] = history.get("measurements", [])[-1]
        except InvalidAuthenticationError as err:
            raise ConfigEntryAuthFailed("Invalid Samba password") from err
        except NodeConnectionError as err:
            if self.reload_task is None:
                self.reload_task = self.hass.async_create_task(
                    self.hass.config_entries.async_reload(self.config_entry.entry_id)
                )
            raise UpdateFailed(f"Connection to Pro unit lost: {err}") from err
        except NodeProError as err:
            raise UpdateFailed(f"Error while retrieving data: {err}") from err

        return data

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Read the wrapped err message — it typically names the parse/format failure.
  2. Power-cycle the AirVisual Pro unit to clear corrupt data files.
  3. Check for firmware updates or known issues with the nodeairvisualpro library version in use.
  4. If it started right after a firmware upgrade, report the format change upstream.
  5. Reload the integration after the unit stabilizes.
Defensive patterns

Strategy: try-catch

Type guard

def is_airvisual_pro_data_error(err: Exception) -> bool:
    return isinstance(err, UpdateFailed) and str(err).startswith("Error while retrieving data")

Try / catch

try:
    await coordinator.async_refresh()
except UpdateFailed as err:
    if not str(err).startswith("Connection to Pro unit lost"):
        # data-format/parse problem: power-cycle unit or check firmware; retrying rarely helps
        _LOGGER.warning("AirVisual Pro data error: %s", err)

Prevention

When it happens

Trigger: The Samba read succeeds but parsing fails: the unit's CSV/JSON data file has an unexpected format (new firmware), the file is empty mid-write, or partial file contents are read while the unit rotates its log — raising NodeProError rather than a connection error.

Common situations: Firmware update changing the data file layout, reading a file mid-write producing truncated data, or unit storage issues producing corrupt files.

Related errors


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