{"record":{"id":"ab21a8cb12391a5b","repo":"home-assistant/core","slug":"cannot-retrieve-data-with-error","errorCode":"cannot_retrieve_data_with_error","errorMessage":"Error retrieving data: {error}","messagePattern":"Error retrieving data: (.+?)","errorType":"exception","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/alexa_devices/coordinator.py","lineNumber":69,"sourceCode":"        if coordinator:\n            coordinator.last_update_success = False\n        raise HomeAssistantError(\n            translation_domain=DOMAIN,\n            translation_key=\"invalid_auth\",\n            translation_placeholders={\"error\": repr(err)},\n        ) from err\n    except CannotConnect as err:\n        if coordinator:\n            coordinator.last_update_success = False\n        raise HomeAssistantError(\n            translation_domain=DOMAIN,\n            translation_key=\"cannot_connect_with_error\",\n            translation_placeholders={\"error\": repr(err)},\n        ) from err\n    except (CannotRetrieveData, ValueError) as err:\n        if coordinator:\n            coordinator.last_update_success = False\n        raise HomeAssistantError(\n            translation_domain=DOMAIN,\n            translation_key=\"cannot_retrieve_data_with_error\",\n            translation_placeholders={\"error\": repr(err)},\n        ) from err\n\n\n@asynccontextmanager\nasync def alexa_config_entry_errors() -> AsyncGenerator[None]:\n    \"\"\"Handle common Alexa API exceptions as ConfigEntry errors.\"\"\"\n    try:\n        yield\n    except CannotAuthenticate as err:\n        raise ConfigEntryAuthFailed(\n            translation_domain=DOMAIN,\n            translation_key=\"invalid_auth\",\n            translation_placeholders={\"error\": repr(err)},\n        ) from err\n    except (CannotConnect, TimeoutError) as err:","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/alexa_devices/coordinator.py#L51-L87","documentation":"Raised as a HomeAssistantError (translation key alexa_devices/cannot_retrieve_data_with_error) when alexapy raises CannotRetrieveData or a ValueError inside the alexa_api_call context manager. It means the request reached Amazon but the response could not be turned into usable data (unexpected payload, parse failure, or malformed input values).","triggerScenarios":"Wrapped Alexa API calls where Amazon returns an unexpected/empty payload, JSON that does not match the expected schema (raises CannotRetrieveData), or where request construction produces an invalid value (ValueError) — e.g. a device serial missing from coordinator.data or an API response format change.","commonSituations":"Amazon altering its undocumented API response shapes after an app update, alexapy library version lagging behind Amazon changes, or corrupt local coordinator state leading to ValueError during calls.","solutions":["Update the alexapy library / Home Assistant core to the latest version so response parsing matches current Amazon payloads","Reload the alexa_devices integration to rebuild coordinator state from a fresh fetch","Inspect the placeholder error (repr of the exception) in the log to identify whether it is CannotRetrieveData or ValueError and which payload failed","If reproducible, report the payload mismatch to the alexapy maintainers"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    async with alexa_api_call():\n        await coordinator.api.some_call(...)\nexcept HomeAssistantError as err:\n    if err.translation_key == \"cannot_retrieve_data_with_error\":\n        _LOGGER.warning(\"Alexa data unusable: %s\", err)  # do not retry blindly; parse issue","preventionTips":["Keep Home Assistant core updated so alexapy parsers track Amazon API changes","Check the repr(err) placeholder in logs to identify the exact failing value/payload","Treat parse failures as non-retryable; retrying the same malformed request rarely helps"],"tags":["alexa-devices","data-parsing","api-contract","homeassistant"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}