BerriAI/litellm · error · ValueError

Missing required environment variable…

Error message

Missing required environment variable: AZURE_STORAGE_FILE_SYSTEM

What it means

AzureBlobStorageLogger requires AZURE_STORAGE_FILE_SYSTEM — the ADLS Gen2 filesystem (container) name inside the storage account where log blobs are written — with no default and no constructor fallback; init raises when it is unset. The filesystem must already exist or writes will fail later even after this check passes.

Solutions

  1. Create the filesystem if needed: `az storage fs create --name litellm-logs --account-name <account>` (or container create)
  2. Export AZURE_STORAGE_FILE_SYSTEM=<filesystem name>
  3. Optionally set AZURE_STORAGE_ENDPOINT_SUFFIX if using sovereign clouds (defaults to the public-cloud suffix)
  4. Re-run the proxy/process so init sees the variable

Example fix

// before
export AZURE_STORAGE_ACCOUNT_NAME="mystgacct"   # filesystem never set
// after
export AZURE_STORAGE_ACCOUNT_NAME="mystgacct"
export AZURE_STORAGE_FILE_SYSTEM="litellgpt-logs"
Defensive patterns

Strategy: validation

Validate before calling

import os

fs_name = os.getenv("AZURE_STORAGE_FILE_SYSTEM")
if not fs_name:
    raise RuntimeError("set AZURE_STORAGE_FILE_SYSTEM to an existing ADLS Gen2 filesystem name")

Type guard

def is_valid_file_system_name(name: str) -> bool:
    import re
    return bool(re.fullmatch(r"[a-z0-9][a-z0-9-]{2,62}", name))

Prevention

When it happens

Trigger: Enabling the azure_storage logger with the account name set but the container never created; assuming a default container is auto-provisioned; renaming the filesystem without updating env; copying configs between projects that use different container names.

Common situations: Account provisioned via IaC but the `az storage fs create` step skipped; naming drift between environments (litellm-logs vs litellm_logs); empty-string value from a misconfigured secret.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/f8dd7dee9304899c. Report an issue: GitHub.

Appendix: source

Thrown at litellm/integrations/azure_storage/azure_storage.py:46

        **kwargs,
    ):
        try:
            verbose_logger.debug("AzureBlobStorageLogger: in init azure blob storage logger")

            # Env Variables used for Azure Storage Authentication
            self.tenant_id = os.getenv("AZURE_STORAGE_TENANT_ID")
            self.client_id = os.getenv("AZURE_STORAGE_CLIENT_ID")
            self.client_secret = os.getenv("AZURE_STORAGE_CLIENT_SECRET")
            self.azure_storage_account_key: str | None = os.getenv("AZURE_STORAGE_ACCOUNT_KEY")

            # Required Env Variables for Azure Storage
            _azure_storage_account_name: Final = os.getenv("AZURE_STORAGE_ACCOUNT_NAME")
            if not _azure_storage_account_name:
                raise ValueError("Missing required environment variable: AZURE_STORAGE_ACCOUNT_NAME")
            self.azure_storage_account_name: str = _azure_storage_account_name
            _azure_storage_file_system: Final = os.getenv("AZURE_STORAGE_FILE_SYSTEM")
            if not _azure_storage_file_system:
                raise ValueError("Missing required environment variable: AZURE_STORAGE_FILE_SYSTEM")
            self.azure_storage_file_system: str = _azure_storage_file_system
            self.azure_storage_endpoint_suffix: str = (
                os.getenv("AZURE_STORAGE_ENDPOINT_SUFFIX") or AZURE_STORAGE_DEFAULT_ENDPOINT_SUFFIX
            )
            self._service_client = None
            # Time that the azure service client expires, in order to reset the connection pool and keep it fresh
            self._service_client_timeout: float | None = None

            # Internal variables used for Token based authentication
            self.azure_auth_token: str | None = None  # the Azure AD token to use for Azure Storage API requests
            self.token_expiry: datetime | None = None  # the expiry time of the currentAzure AD token

            asyncio.create_task(self.periodic_flush())
            self.flush_lock = asyncio.Lock()
            self.log_queue: list[StandardLoggingPayload] = []
            super().__init__(**kwargs, flush_lock=self.flush_lock)
        except Exception as e:
            verbose_logger.exception(

View on GitHub (pinned to 77b7c6c40c)