{"record":{"id":"576464056f9a1d44","repo":"home-assistant/core","slug":"cannot-connect-with-error","errorCode":"cannot_connect_with_error","errorMessage":"Error connecting: {error}","messagePattern":"Error connecting: (.+?)","errorType":"exception","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/alexa_devices/coordinator.py","lineNumber":61,"sourceCode":"@asynccontextmanager\nasync def alexa_api_call(\n    coordinator: DataUpdateCoordinator | None = None,\n) -> AsyncGenerator[None]:\n    \"\"\"Handle common Alexa API exceptions as HomeAssistantError.\"\"\"\n    try:\n        yield\n    except CannotAuthenticate as err:\n        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:","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/alexa_devices/coordinator.py#L43-L79","documentation":"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.","triggerScenarios":"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.","commonSituations":"Local internet outage, firewall/proxy blocking amazon.com, Amazon AWS incidents, IPv6 misconfiguration, or DNS resolver failures on the host running Home Assistant.","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"],"exampleFix":null,"handlingStrategy":"retry","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_connect_with_error\":\n        await asyncio.sleep(BACKOFF)  # or schedule retry\n        # retry once; give up after N attempts","preventionTips":["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"],"tags":["alexa-devices","network","connectivity","homeassistant"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}