home-assistant/core · error · ConfigEntryAuthFailed

Credentials error from CalDAV server

Error message

Credentials error from CalDAV server

What it means

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.

Source

Thrown at homeassistant/components/caldav/__init__.py:43


PLATFORMS: list[Platform] = [Platform.CALENDAR, Platform.TODO]


async def async_setup_entry(hass: HomeAssistant, entry: CalDavConfigEntry) -> bool:
    """Set up CalDAV from a config entry."""
    client = caldav.DAVClient(
        entry.data[CONF_URL],
        username=entry.data[CONF_USERNAME],
        password=entry.data[CONF_PASSWORD],
        ssl_verify_cert=entry.data[CONF_VERIFY_SSL],
        timeout=TIMEOUT,
    )
    try:
        await hass.async_add_executor_job(client.principal)
    except AuthorizationError as err:
        if err.reason == "Unauthorized":
            raise ConfigEntryAuthFailed("Credentials error from CalDAV server") from err
        # AuthorizationError can be raised if the url is incorrect or
        # on some other unexpected server response.
        _LOGGER.warning("Unexpected CalDAV server response: %s", err)
        return False
    except requests.Timeout as err:
        raise ConfigEntryNotReady("Timeout connecting to CalDAV server") from err
    except requests.ConnectionError as err:
        raise ConfigEntryNotReady("Connection error from CalDAV server") from err
    except DAVError as err:
        raise ConfigEntryNotReady("CalDAV client error") from err

    entry.runtime_data = client

    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

    return True

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Re-authenticate the config entry via Home Assistant UI notification or Settings > Devices & Services > CalDAV > Reconfigure
  2. Verify the username/password pair against the server with curl (PROPFIND on the principal URL)
  3. If the provider requires app-specific passwords (e.g. iCloud), generate and use one
  4. Confirm the URL points to the real CalDAV endpoint (not a plain webdav or HTML login page)
Defensive patterns

Strategy: try-catch

Try / catch

try:
    await hass.async_add_executor_job(client.principal)
except AuthorizationError as err:
    if err.reason == "Unauthorized":
        raise ConfigEntryAuthFailed("Credentials error from CalDAV server") from err
    _LOGGER.warning("Unexpected CalDAV server response: %s", err)
    return False

Prevention

When it happens

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

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

Related errors


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