BerriAI/litellm · error · ValueError

oci_signer cannot be None when calling sign_with_oci_signer

Error message

oci_signer cannot be None when calling sign_with_oci_signer

What it means

Error "oci_signer cannot be None when calling sign_with_oci_signer" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/oci/common_utils.py:227

    request_data: dict,
    api_base: str,
) -> tuple[dict, bytes]:
    """Sign a request using an OCI SDK Signer object passed in optional_params."""
    oci_signer: Final = optional_params.get("oci_signer")
    body: Final = json.dumps(request_data).encode("utf-8")
    method: Final = str(optional_params.get("method", "POST")).upper()

    if method not in {"POST", "GET", "PUT", "DELETE", "PATCH"}:
        raise ValueError(f"Unsupported HTTP method: {method}")

    prepared_headers: Final = {**headers}
    prepared_headers.setdefault("content-type", "application/json")
    prepared_headers.setdefault("content-length", str(len(body)))

    request_wrapper: Final = OCIRequestWrapper(method=method, url=api_base, headers=prepared_headers, body=body)

    if oci_signer is None:
        raise ValueError("oci_signer cannot be None when calling sign_with_oci_signer")

    try:
        oci_signer.do_request_sign(request_wrapper, enforce_content_headers=True)
    except Exception as e:
        raise OCIError(
            status_code=500,
            message=(
                f"Failed to sign request with provided oci_signer: {e}. "
                "The signer must implement the OCI SDK Signer interface with a "
                "do_request_sign(request, enforce_content_headers=True) method. "
                "See: https://docs.oracle.com/en-us/iaas/tools/python/latest/api/signing.html"
            ),
        ) from e

    headers.update(request_wrapper.headers)
    return headers, body

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass a non-None oci_signer (an OCI SDK Signer instance) when calling the signing helper.

When it happens

Trigger: Thrown at litellm/llms/oci/common_utils.py:227 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/bab7e08d7ed7d135. Report an issue: GitHub.