{"record":{"id":"d51476f064935f07","repo":"home-assistant/core","slug":"received-invalid-data-type","errorCode":null,"errorMessage":"Received invalid data type","messagePattern":"Received invalid data type","errorType":"exception","errorClass":"UpdateFailed","httpStatus":null,"severity":"error","filePath":"homeassistant/components/asuswrt/bridge.py","lineNumber":107,"sourceCode":"    \"\"\"Run library methods and zip results or manage exceptions.\"\"\"\n\n    def _handle_errors_and_zip(\n        func: _FuncType[_AsusWrtBridgeT],\n    ) -> _ReturnFuncType[_AsusWrtBridgeT]:\n        \"\"\"Run library methods and zip results or manage exceptions.\"\"\"\n\n        @functools.wraps(func)\n        async def _wrapper(\n            self: _AsusWrtBridgeT,\n        ) -> dict[str, float | str | None] | dict[str, float]:\n            try:\n                data = await func(self)\n            except exceptions as exc:\n                raise UpdateFailed(exc) from exc\n\n            if keys is None:\n                if not isinstance(data, dict):\n                    raise UpdateFailed(\"Received invalid data type\")\n                return data\n\n            if isinstance(data, dict):\n                return dict(zip(keys, list(data.values()), strict=False))\n            return dict(zip(keys, data, strict=False))\n\n        return _wrapper\n\n    return _handle_errors_and_zip\n\n\nclass AsusWrtBridge(ABC):\n    \"\"\"The Base Bridge abstract class.\"\"\"\n\n    @staticmethod\n    def get_bridge(\n        hass: HomeAssistant,\n        conf: dict[str, str | int],","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/asuswrt/bridge.py#L89-L125","documentation":"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.","triggerScenarios":"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.","commonSituations":"Router firmware update changed command output so parsing yields a non-dict; library version regression; intermittent half-responses during high router load.","solutions":["Update the aioasuswrt package to the latest version (often fixes parsing after firmware changes)","Reboot the router and trigger a manual refresh to rule out a one-off malformed response","SSH into the router and run the underlying command to inspect whether output shape changed","If persistent on new firmware, report the firmware version to the asuswrt integration maintainers"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"data = await bridge.async_get_active_properties()\nassert isinstance(data, dict), f\"unexpected payload: {type(data)}\"","typeGuard":"def is_sensor_dict(data: object) -> bool:\n    return isinstance(data, dict) and all(\n        isinstance(v, (int, float, str, type(None))) for v in data.values()\n    )","tryCatchPattern":"try:\n    data = await bridge.async_get_active_properties()\nexcept UpdateFailed as err:\n    if str(err) == \"Received invalid data type\":\n        # router firmware/library mismatch: log and skip this cycle\n        return None\n    raise","preventionTips":["Pin known-good aioasuswrt versions until firmware is validated","Log the raw payload type when this fires to speed diagnosis","Test after every router firmware upgrade"],"tags":["asuswrt","router","data-validation","coordinator"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}