home-assistant/core · error · HomeAssistantError

cannot_retrieve_data_with_error

cannot_retrieve_data_with_error

Error message

Error retrieving data: {error}

What it means

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).

Source

Thrown at homeassistant/components/alexa_devices/coordinator.py:69

        if coordinator:
            coordinator.last_update_success = False
        raise HomeAssistantError(
            translation_domain=DOMAIN,
            translation_key="invalid_auth",
            translation_placeholders={"error": repr(err)},
        ) from err
    except CannotConnect as err:
        if coordinator:
            coordinator.last_update_success = False
        raise HomeAssistantError(
            translation_domain=DOMAIN,
            translation_key="cannot_connect_with_error",
            translation_placeholders={"error": repr(err)},
        ) from err
    except (CannotRetrieveData, ValueError) as err:
        if coordinator:
            coordinator.last_update_success = False
        raise HomeAssistantError(
            translation_domain=DOMAIN,
            translation_key="cannot_retrieve_data_with_error",
            translation_placeholders={"error": repr(err)},
        ) from err


@asynccontextmanager
async def alexa_config_entry_errors() -> AsyncGenerator[None]:
    """Handle common Alexa API exceptions as ConfigEntry errors."""
    try:
        yield
    except CannotAuthenticate as err:
        raise ConfigEntryAuthFailed(
            translation_domain=DOMAIN,
            translation_key="invalid_auth",
            translation_placeholders={"error": repr(err)},
        ) from err
    except (CannotConnect, TimeoutError) as err:

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Update the alexapy library / Home Assistant core to the latest version so response parsing matches current Amazon payloads
  2. Reload the alexa_devices integration to rebuild coordinator state from a fresh fetch
  3. Inspect the placeholder error (repr of the exception) in the log to identify whether it is CannotRetrieveData or ValueError and which payload failed
  4. If reproducible, report the payload mismatch to the alexapy maintainers
Defensive patterns

Strategy: try-catch

Try / catch

try:
    async with alexa_api_call():
        await coordinator.api.some_call(...)
except HomeAssistantError as err:
    if err.translation_key == "cannot_retrieve_data_with_error":
        _LOGGER.warning("Alexa data unusable: %s", err)  # do not retry blindly; parse issue

Prevention

When it happens

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

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

Related errors


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