BerriAI/litellm · error · ValueError

SAP AI Core credentials not found. Please provide credential

Error message

SAP AI Core credentials not found. Please provide credentials by setting appropriate environment variables (e.g. AICORE_CLIENT_ID, AICORE_CLIENT_SECRET, etc.)

What it means

SAP AI Core credential validation: one of the mandatory fields (auth_url, client_id, base_url) is absent after resolution from env/config, so no valid credentials exist and a ValueError listing the AICORE_* env vars is raised.

Source

Thrown at litellm/llms/sap/credentials.py:332

        client_id: OAuth2 client ID (required)
        client_secret: OAuth2 client secret (for secret-based auth)
        cert_str: PEM-encoded certificate string (for cert-based auth)
        key_str: PEM-encoded private key string (for cert-based auth)
        cert_file_path: Path to certificate file (for file-based cert auth)
        key_file_path: Path to private key file (for file-based cert auth)

    Raises:
        ValueError: If required fields are missing or authentication mode is ambiguous.

    Note:
        - This function does NOT validate resource_group (resolved separately).
        - Exactly one authentication method must be provided:
          * client_secret, OR
          * (cert_str AND key_str), OR
          * (cert_file_path AND key_file_path)
    """
    if not auth_url or not client_id or not base_url:
        raise ValueError(
            "SAP AI Core credentials not found. "
            "Please provide credentials by setting appropriate environment variables "
            "(e.g. AICORE_CLIENT_ID, AICORE_CLIENT_SECRET, etc.)"
        )

    modes: Final = [
        bool(client_secret),
        bool(cert_str) and bool(key_str),
        bool(cert_file_path) and bool(key_file_path),
    ]
    if sum(bool(m) for m in modes) != 1:
        raise ValueError(
            "SAP AI Core credentials are incomplete. "
            "Invalid credentials: provide exactly one of client_secret, "
            "(cert_str & key_str), or (cert_file_path & key_file_path)."
        )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set the SAP AI Core environment variables (AICORE_CLIENT_ID, AICORE_CLIENT_SECRET, etc.).
  2. Or provide a credentials config file via AICORE_HOME.

Example fix

export AICORE_CLIENT_ID=<id> AICORE_CLIENT_SECRET=<secret>
Defensive patterns

Strategy: validation

When it happens

Trigger: Triggered when SAP AI Core credentials are missing; set env vars such as AICORE_CLIENT_ID and AICORE_CLIENT_SECRET.

Common situations: See trigger scenarios.


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