home-assistant/core · error · ConfigEntryError

account_not_found

Error message

account_not_found

What it means

Raised as ConfigEntryError (translation key account_not_found) when the Azure Blob Storage container_client.exists()/create_container() call fails with ResourceNotFoundError during setup. It signals that the storage account named in the config entry does not exist (HTTP 404 at the account level, not just a missing container). This is a fatal setup error; HA will not retry automatically.

Source

Thrown at homeassistant/components/azure_storage/__init__.py:62

        """Create a ContainerClient."""

        return ContainerClient(
            account_url=f"https://{entry.data[CONF_ACCOUNT_NAME]}.blob.core.windows.net/",
            container_name=entry.data[CONF_CONTAINER_NAME],
            credential=entry.data[CONF_STORAGE_ACCOUNT_KEY],
            transport=AioHttpTransport(session=session),
        )

    # has a blocking call to open in cpython
    container_client: ContainerClient = await hass.async_add_executor_job(
        create_container_client
    )

    try:
        if not await container_client.exists():
            await container_client.create_container()
    except ResourceNotFoundError as err:
        raise ConfigEntryError(
            translation_domain=DOMAIN,
            translation_key="account_not_found",
            translation_placeholders={CONF_ACCOUNT_NAME: entry.data[CONF_ACCOUNT_NAME]},
        ) from err
    except ClientAuthenticationError as err:
        raise ConfigEntryAuthFailed(
            translation_domain=DOMAIN,
            translation_key="invalid_auth",
            translation_placeholders={CONF_ACCOUNT_NAME: entry.data[CONF_ACCOUNT_NAME]},
        ) from err
    except AzureError as err:
        raise ConfigEntryNotReady(
            translation_domain=DOMAIN,
            translation_key="cannot_connect",
            translation_placeholders={CONF_ACCOUNT_NAME: entry.data[CONF_ACCOUNT_NAME]},
        ) from err

    entry.runtime_data = container_client

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Confirm the storage account name in the Azure portal and fix it in the integration's reconfigure flow
  2. Check that the account exists in the subscription the credentials (SAS token or entra auth) can see
  3. If the account was intentionally recreated, update the config entry with the new account name and key/SAS
  4. Distinguish from a missing container: a missing container is auto-created (create_container) only when the account itself resolves
Defensive patterns

Strategy: validation

Validate before calling

from azure.storage.blob import ContainerClient
cs = f"DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};EndpointSuffix=core.windows.net"
client = ContainerClient.from_connection_string(cs, container_name)
if not await client.exists():
    # account reachable; container will be auto-created
    pass

Type guard

def is_account_not_found(err: BaseException) -> bool:
    from azure.core.exceptions import ResourceNotFoundError
    return isinstance(err, ResourceNotFoundError)

Try / catch

try:
    if not await container_client.exists():
        await container_client.create_container()
except ResourceNotFoundError as err:
    raise ConfigEntryError(translation_domain=DOMAIN, translation_key="account_not_found", ...) from err

Prevention

When it happens

Trigger: setup_entry builds a ContainerClient for the account; exists() returns HTTP 404 because the account name is mistyped or the account was deleted, so ResourceNotFoundError maps to ConfigEntryError.

Common situations: Typo in the account name during config flow, storage account deleted or renamed, using the wrong Azure subscription/tenant credentials that resolve to a different environment.

Related errors


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