BerriAI/litellm · error · ValueError

Environment variable

Error message

Environment variable {oidc_aud} not found

What it means

OIDC failure for the 'env'-style audience resolution: the code treats oidc_aud as an environment variable name and the lookup returned None, so the expected token environment variable is not set in the process.

Solutions

  1. Export the environment variable named by {oidc_aud} containing the OIDC audience/token value before the request.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/secret_managers/main.py:302 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at litellm/secret_managers/main.py:302

                    return oidc_token
                except Exception as e:
                    error_msg: Final = f"Azure OIDC provider failed: {e}"
                    verbose_logger.error(error_msg)
                    raise ValueError(error_msg)
            with open(azure_federated_token_file, "r") as f:
                oidc_token = f.read()
                return oidc_token
        elif oidc_provider == "file":
            # Load token from a file within an allowed credential directory.
            safe_path: Final = _resolve_oidc_file_path(oidc_aud)
            with open(safe_path, "r") as f:
                oidc_token = f.read()
                return oidc_token
        elif oidc_provider == "env":
            # Load token directly from an environment variable
            oidc_token = os.getenv(oidc_aud)
            if oidc_token is None:
                raise ValueError(f"Environment variable {oidc_aud} not found")
            return oidc_token
        elif oidc_provider == "env_path":
            # Load token from a file path specified in an environment variable
            token_file_path: Final = os.getenv(oidc_aud)
            if token_file_path is None:
                raise ValueError(f"Environment variable {oidc_aud} not found")
            with open(token_file_path, "r") as f:
                oidc_token = f.read()
                return oidc_token
        else:
            raise ValueError("Unsupported OIDC provider")

    try:
        if _should_read_secret_from_secret_manager() and litellm.secret_manager_client is not None:
            try:
                client: Final = litellm.secret_manager_client
                key_manager = "local"
                if key_management_system is not None:

View on GitHub (pinned to 77b7c6c40c)