home-assistant/core · error · UpdateFailed

Received invalid data type

Error message

Received invalid data type

What it means

UpdateFailed('Received invalid data type') from the asuswrt bridge decorator when keys is None (raw-dict mode) and the library method returned something other than a dict. It guards the bridge's contract that raw sensor data methods must yield mapping objects before being handed to the coordinator.

Source

Thrown at homeassistant/components/asuswrt/bridge.py:107

    """Run library methods and zip results or manage exceptions."""

    def _handle_errors_and_zip(
        func: _FuncType[_AsusWrtBridgeT],
    ) -> _ReturnFuncType[_AsusWrtBridgeT]:
        """Run library methods and zip results or manage exceptions."""

        @functools.wraps(func)
        async def _wrapper(
            self: _AsusWrtBridgeT,
        ) -> dict[str, float | str | None] | dict[str, float]:
            try:
                data = await func(self)
            except exceptions as exc:
                raise UpdateFailed(exc) from exc

            if keys is None:
                if not isinstance(data, dict):
                    raise UpdateFailed("Received invalid data type")
                return data

            if isinstance(data, dict):
                return dict(zip(keys, list(data.values()), strict=False))
            return dict(zip(keys, data, strict=False))

        return _wrapper

    return _handle_errors_and_zip


class AsusWrtBridge(ABC):
    """The Base Bridge abstract class."""

    @staticmethod
    def get_bridge(
        hass: HomeAssistant,
        conf: dict[str, str | int],

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Update the aioasuswrt package to the latest version (often fixes parsing after firmware changes)
  2. Reboot the router and trigger a manual refresh to rule out a one-off malformed response
  3. SSH into the router and run the underlying command to inspect whether output shape changed
  4. If persistent on new firmware, report the firmware version to the asuswrt integration maintainers
Defensive patterns

Strategy: type-guard

Validate before calling

data = await bridge.async_get_active_properties()
assert isinstance(data, dict), f"unexpected payload: {type(data)}"

Type guard

def is_sensor_dict(data: object) -> bool:
    return isinstance(data, dict) and all(
        isinstance(v, (int, float, str, type(None))) for v in data.values()
    )

Try / catch

try:
    data = await bridge.async_get_active_properties()
except UpdateFailed as err:
    if str(err) == "Received invalid data type":
        # router firmware/library mismatch: log and skip this cycle
        return None
    raise

Prevention

When it happens

Trigger: An aioasuswrt data method that normally returns a dict returns None/list/str — e.g. a truncated nvram/temperature response after a firmware change, or a code path where the library returns a scalar on partial failure.

Common situations: Router firmware update changed command output so parsing yields a non-dict; library version regression; intermittent half-responses during high router load.

Related errors


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