{"record":{"id":"b5d3376c10800219","repo":"home-assistant/core","slug":"credentials-error-from-caldav-server","errorCode":null,"errorMessage":"Credentials error from CalDAV server","messagePattern":"Credentials error from CalDAV server","errorType":"exception","errorClass":"ConfigEntryAuthFailed","httpStatus":null,"severity":"error","filePath":"homeassistant/components/caldav/__init__.py","lineNumber":43,"sourceCode":"\n\nPLATFORMS: list[Platform] = [Platform.CALENDAR, Platform.TODO]\n\n\nasync def async_setup_entry(hass: HomeAssistant, entry: CalDavConfigEntry) -> bool:\n    \"\"\"Set up CalDAV from a config entry.\"\"\"\n    client = caldav.DAVClient(\n        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","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/caldav/__init__.py#L25-L61","documentation":"ConfigEntryAuthFailed raised during CalDAV setup when client.principal() raises AuthorizationError with reason 'Unauthorized', i.e. the server explicitly rejected the provided credentials. Home Assistant then starts the reauthentication flow for the config entry instead of retrying setup.","triggerScenarios":"async_setup_entry runs, calls client.principal() over the executor, and the CalDAV server returns HTTP 401 with an AuthorizationError whose reason is exactly 'Unauthorized'. Typically wrong username/password, or an app-specific password requirement.","commonSituations":"Changed or expired account password, providers requiring app-specific passwords (iCloud, Google via CalDAV connectors), or a URL pointing to the wrong endpoint where the credentials are not accepted.","solutions":["Re-authenticate the config entry via Home Assistant UI notification or Settings > Devices & Services > CalDAV > Reconfigure","Verify the username/password pair against the server with curl (PROPFIND on the principal URL)","If the provider requires app-specific passwords (e.g. iCloud), generate and use one","Confirm the URL points to the real CalDAV endpoint (not a plain webdav or HTML login page)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    await hass.async_add_executor_job(client.principal)\nexcept AuthorizationError as err:\n    if err.reason == \"Unauthorized\":\n        raise ConfigEntryAuthFailed(\"Credentials error from CalDAV server\") from err\n    _LOGGER.warning(\"Unexpected CalDAV server response: %s\", err)\n    return False","preventionTips":["Use app-specific passwords where the provider requires them","Test credentials with a curl PROPFIND before configuring the entry","Point the entry at the documented CalDAV endpoint so auth is actually exercised"],"tags":["homeassistant","caldav","authentication","config-entry"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}