home-assistant/core · error · HomeAssistantError
cannot_connect_with_error
cannot_connect_with_error
Error message
Error connecting: {error} What it means
Raised as a HomeAssistantError (translation key alexa_devices/cannot_connect_with_error) when alexapy raises CannotConnect inside the alexa_api_call context manager. It indicates a transport-level failure reaching Amazon's Alexa cloud endpoints (DNS, TCP, TLS, HTTP 5xx). The coordinator is marked unsuccessful so the UI reflects the outage.
Source
Thrown at homeassistant/components/alexa_devices/coordinator.py:61
@asynccontextmanager
async def alexa_api_call(
coordinator: DataUpdateCoordinator | None = None,
) -> AsyncGenerator[None]:
"""Handle common Alexa API exceptions as HomeAssistantError."""
try:
yield
except CannotAuthenticate as err:
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:View on GitHub (pinned to 58a3fdb3ea)
Solutions
- Check general internet connectivity from the Home Assistant host (curl https://alexa.amazon.com)
- Verify DNS resolution and that no proxy/firewall blocks Amazon endpoints
- Check Amazon/AWS status pages for an ongoing incident and retry later
- If persistent, reload the alexa_devices integration after connectivity is restored
Defensive patterns
Strategy: retry
Try / catch
try:
async with alexa_api_call():
await coordinator.api.some_call(...)
except HomeAssistantError as err:
if err.translation_key == "cannot_connect_with_error":
await asyncio.sleep(BACKOFF) # or schedule retry
# retry once; give up after N attempts Prevention
- Ensure reliable DNS and outbound HTTPS to amazon.com on the HA host
- Wrap one-shot automations with retry logic since transient network blips are common
- Monitor the coordinator's last_update_success instead of assuming success
When it happens
Trigger: Any wrapped Alexa API call (e.g. coordinator.api.call_alexa_sound, get_devices_data via entity/service paths using alexa_api_call) when the HTTP request to amazon.com/alexa endpoints fails to connect, times out at the socket level, or Amazon returns a server error mapped to CannotConnect.
Common situations: Local internet outage, firewall/proxy blocking amazon.com, Amazon AWS incidents, IPv6 misconfiguration, or DNS resolver failures on the host running Home Assistant.
Related errors
- Error communicating with API: {e}
- invalid_auth
- cannot_retrieve_data_with_error
- invalid_device_id
- entry_not_loaded
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/576464056f9a1d44.
Report an issue: GitHub.