BerriAI/litellm · critical · OCIError

Missing required parameters: oci_user, oci_fingerprint, oci_

Error message

Missing required parameters: oci_user, oci_fingerprint, oci_tenancy, oci_compartment_id and at least one of oci_key or oci_key_file. These can be supplied via optional_params or via OCI_USER, OCI_FINGERPRINT, OCI_TENANCY, OCI_COMPARTMENT_ID, OCI_KEY_FILE environment variables. Alternatively, provide an oci_signer object from the OCI SDK.

What it means

The OCI embeddings config's validate_environment checks (unless an oci_signer is provided) that user, fingerprint, tenancy, compartment_id and a key source are all present, raising OCIError(401) listing the env-var alternatives. Embeddings additionally require oci_compartment_id because the OCI embedding API bills and scopes requests per compartment.

Source

Thrown at litellm/llms/oci/embed/transformation.py:129

        optional_params: dict,
        litellm_params: dict,
        api_key: str | None = None,
        api_base: str | None = None,
    ) -> dict:
        if optional_params.get("oci_signer") is None:
            creds: Final = resolve_oci_credentials(optional_params)
            missing: Final = [
                k
                for k in (
                    "oci_user",
                    "oci_fingerprint",
                    "oci_tenancy",
                    "oci_compartment_id",
                )
                if not creds.get(k)
            ]
            if missing or not (creds.get("oci_key") or creds.get("oci_key_file")):
                raise OCIError(
                    status_code=401,
                    message=(
                        "Missing required parameters: oci_user, oci_fingerprint, oci_tenancy, "
                        "oci_compartment_id and at least one of oci_key or oci_key_file. "
                        "These can be supplied via optional_params or via OCI_USER, OCI_FINGERPRINT, "
                        "OCI_TENANCY, OCI_COMPARTMENT_ID, OCI_KEY_FILE environment variables. "
                        "Alternatively, provide an oci_signer object from the OCI SDK."
                    ),
                )
        return validate_oci_environment(headers, optional_params, api_key)

    def get_complete_url(
        self,
        api_base: str | None,
        api_key: str | None,
        model: str,
        optional_params: dict,
        litellm_params: dict,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Set OCI_COMPARTMENT_ID (or pass oci_compartment_id in optional params) to the compartment OCID (ocid1.compartment.oc1.....) that hosts/has access to the embedding model.
  2. Set the remaining credentials: OCI_USER, OCI_FINGERPRINT, OCI_TENANCY, OCI_KEY_FILE (or inline OCI_KEY).
  3. Alternatively pass an OCI SDK oci_signer to skip manual credential checks.
  4. Verify all five values inside the failing process before the call.

Example fix

# before
litellm.embedding(model="oci/generic.embedding.multilingual.v1.5", input=["hello"])
# OCIError 401: missing oci_compartment_id

# after
os.environ["OCI_COMPARTMENT_ID"] = "ocid1.compartment.oc1..aaaa..."
litellm.embedding(model="oci/generic.embedding.multilingual.v1.5", input=["hello"])
Defensive patterns

Strategy: validation

Validate before calling

import os
required = ("OCI_USER", "OCI_FINGERPRINT", "OCI_TENANCY", "OCI_COMPARTMENT_ID")
missing = [v for v in required if not os.environ.get(v)]
has_key = bool(os.environ.get("OCI_KEY") or os.environ.get("OCI_KEY_FILE"))
assert not missing and has_key, f"missing OCI embedding config: {missing}, key={not has_key}"

Try / catch

from litellm.llms.oci.common_utils import OCIError
try:
    litellm.embedding(model="oci/generic.embedding.multilingual.v1.5", input=texts)
except OCIError as e:
    if e.status_code == 401 and "Missing required parameters" in str(e):
        raise ConfigError("set OCI_* env vars incl. OCI_COMPARTMENT_ID, or pass oci_signer") from e
    raise

Prevention

When it happens

Trigger: litellm.embedding(..., model='oci/...') where any of OCI_USER, OCI_FINGERPRINT, OCI_TENANCY, OCI_COMPARTMENT_ID, OCI_KEY_FILE (or the optional_params equivalents) is missing.

Common situations: Chat completions work (no compartment needed) but embeddings fail — the classic missing-OCI_COMPARTMENT_ID case; same deployment/env gaps as chat (container missing env vars) plus compartment OCID never copied from the Console.

Related errors


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