{"record":{"id":"01dd5520d6542fdb","repo":"home-assistant/core","slug":"connection-error-from-caldav-server","errorCode":null,"errorMessage":"Connection error from CalDAV server","messagePattern":"Connection error from CalDAV server","errorType":"exception","errorClass":"ConfigEntryNotReady","httpStatus":null,"severity":"warning","filePath":"homeassistant/components/caldav/__init__.py","lineNumber":51,"sourceCode":"        entry.data[CONF_URL],\n        username=entry.data[CONF_USERNAME],\n        password=entry.data[CONF_PASSWORD],\n        ssl_verify_cert=entry.data[CONF_VERIFY_SSL],\n        timeout=TIMEOUT,\n    )\n    try:\n        await hass.async_add_executor_job(client.principal)\n    except AuthorizationError as err:\n        if err.reason == \"Unauthorized\":\n            raise ConfigEntryAuthFailed(\"Credentials error from CalDAV server\") from err\n        # AuthorizationError can be raised if the url is incorrect or\n        # on some other unexpected server response.\n        _LOGGER.warning(\"Unexpected CalDAV server response: %s\", err)\n        return False\n    except requests.Timeout as err:\n        raise ConfigEntryNotReady(\"Timeout connecting to CalDAV server\") from err\n    except requests.ConnectionError as err:\n        raise ConfigEntryNotReady(\"Connection error from CalDAV server\") from err\n    except DAVError as err:\n        raise ConfigEntryNotReady(\"CalDAV client error\") from err\n\n    entry.runtime_data = client\n\n    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)\n\n    return True\n\n\nasync def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n    \"\"\"Unload a config entry.\"\"\"\n    return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)\n","sourceCodeStart":33,"sourceCodeEnd":65,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/caldav/__init__.py#L33-L65","documentation":"ConfigEntryNotReady raised when client.principal() raises requests.ConnectionError — TCP-level failure to connect to the CalDAV URL (DNS failure, refused connection, unreachable host). HA schedules a retry with backoff.","triggerScenarios":"The configured URL cannot be connected to at all: wrong hostname, wrong port, server down, DNS resolution failure, or TLS handshake rejected before HTTP happens.","commonSituations":"Typo in the URL, server offline at HA startup, local DNS not resolving the CalDAV host, or the port/protocol (http vs https) mismatching the listener.","solutions":["Confirm the URL and port from the browser/curl on the same host running Home Assistant","Fix DNS or use an IP/resolvable name; ensure the CalDAV service is running","If using https, verify the certificate is trusted (see CONF_VERIFY_SSL setting in the entry)","Let the retry backoff re-run setup once the server is back"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import socket\nfrom urllib.parse import urlparse\n\nu = urlparse(url)\ntry:\n    socket.create_connection((u.hostname, u.port or 443), timeout=5).close()\n    reachable = True\nexcept OSError:\n    reachable = False","typeGuard":null,"tryCatchPattern":"except requests.ConnectionError as err:\n    raise ConfigEntryNotReady(\"Connection error from CalDAV server\") from err","preventionTips":["Double-check URL/port/protocol in the config entry","Verify DNS resolves on the HA host, not just on a workstation","Reserve a static IP or DNS name for the CalDAV server"],"tags":["homeassistant","caldav","network","connection-refused","config-entry"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}