BerriAI/litellm · error · ValueError

Filesystem {self.azure_storage_file_system} does not exist

Error message

Filesystem {self.azure_storage_file_system} does not exist

What it means

Raised in _download_file_with_account_key when the Azure file system client (named by azure_storage_file_system, i.e. the container) reports exists() == False before download. Despite the 'Filesystem' wording this is the Azure container/filesystem configured for the backend; the code treats a missing container as an invalid state rather than auto-creating it.

Source

Thrown at litellm/llms/base_llm/files/azure_blob_storage_backend.py:262

            if self.azure_storage_account_key:
                # Use Azure SDK (reuse logger's service client)
                return await self._download_file_with_account_key(file_path)
            else:
                # Use REST API (reuse logger's token management)
                return await self._download_file_with_azure_ad(file_path)

        except Exception as e:
            verbose_logger.exception("Error downloading file from Azure Blob Storage: %s", e)
            raise

    async def _download_file_with_account_key(self, file_path: str) -> bytes:
        """Download file using Azure SDK with account key."""
        # Reuse the logger's service client method
        service_client: Final = await self.get_service_client()
        file_system_client: Final = service_client.get_file_system_client(file_system=self.azure_storage_file_system)
        # Ensure filesystem exists (should already exist, but check for safety)
        if not await file_system_client.exists():
            raise ValueError(f"Filesystem {self.azure_storage_file_system} does not exist")
        file_client: Final = file_system_client.get_file_client(file_path)
        # Download file
        download_response: Final = await file_client.download_file()
        file_content: Final = await download_response.readall()
        return file_content

    async def _download_file_with_azure_ad(self, file_path: str) -> bytes:
        """Download file using REST API with Azure AD token."""
        # Reuse the logger's token management
        await self.set_valid_azure_ad_token()

        from litellm.constants import AZURE_STORAGE_MSFT_VERSION
        from litellm.llms.custom_httpx.http_handler import (
            get_async_httpx_client,
            httpxSpecialProvider,
        )

        async_client: Final = get_async_httpx_client(llm_provider=httpxSpecialProvider.LoggingCallback)

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Create the container: az storage container create --account-name <acct> --name <filesystem> (or equivalent in the portal).
  2. Verify AZURE_STORAGE_ACCOUNT_NAME matches the account whose key you configured — the container must live in that account.
  3. Fix typos/case in AZURE_STORAGE_FILE_SYSTEM; Azure container names are lowercase, 3-63 chars.
  4. Confirm the account key has list/read rights so exists() is not falsely negative due to authorization failures.

Example fix

# before: container 'litellm-files' does not exist
AZURE_STORAGE_FILE_SYSTEM=litellm-files

# after
az storage container create --account-name myacct --name litellm-files
# then retry the file download
Defensive patterns

Strategy: validation

Validate before calling

import os
from azure.storage.blob import ContainerClient

def container_ready() -> bool:
    client = ContainerClient.from_connection_string(
        os.environ['AZURE_STORAGE_CONNECTION_STRING'],
        container_name=os.environ['AZURE_STORAGE_FILE_SYSTEM'])
    return client.exists()

Try / catch

try:
    content = await backend.download_file(storage_url)
except ValueError as e:
    if 'does not exist' in str(e):
        provision_container()  # create + retry once
    raise

Prevention

When it happens

Trigger: AZURE_STORAGE_FILE_SYSTEM (or equivalent config) names a container that was never created, was deleted, or is not visible with the account key used; typos in the container name; case mismatches (Azure container names are lowercase).

Common situations: New deployments where the storage account exists but the container was never provisioned; renaming containers without updating litellm env config; using the right container name against the wrong storage account (key from account A, container in account B).

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/d16f15cc62154d4c. Report an issue: GitHub.