BerriAI/litellm · error · OCIError
raw_response.text
Error message
raw_response.text
What it means
After the HTTP request to the OCI embedText endpoint returns, the adapter checks the status code. Any non-200 response is surfaced as an OCIError whose message is the raw response body (`raw_response.text`). This is a pass-through of an upstream OCI API error, not a client-side validation failure.
Source
Thrown at litellm/llms/oci/embed/transformation.py:260
inputType=input_type,
truncate=optional_params.get("truncate", "END"),
outputDimensions=optional_params.get("outputDimensions"),
)
return request.model_dump(exclude_none=True)
def transform_embedding_response(
self,
model: str,
raw_response: httpx.Response,
model_response: EmbeddingResponse,
logging_obj: LiteLLMLoggingObj,
api_key: str | None,
request_data: dict,
optional_params: dict,
litellm_params: dict,
) -> EmbeddingResponse:
if raw_response.status_code != 200:
raise OCIError(
status_code=raw_response.status_code,
message=raw_response.text,
)
try:
json_response: Final = raw_response.json()
except Exception as e:
raise OCIError(
status_code=raw_response.status_code,
message=f"Failed to parse OCI embed response as JSON: {e}",
)
try:
parsed: Final = OCIEmbedResponse(**json_response)
except Exception as e:
raise OCIError(
status_code=500,
message=f"OCI embed response does not match expected schema: {e}",View on GitHub (pinned to 6c2dcb801b)
Solutions
- Read the message body — it contains OCI's own error details (e.g. 'NotAuthorizedOrNotFound', 'TooManyRequests') which pinpoint the fix.
- For 401/403: verify OCI_COMPARTMENT_ID, your user/API key, and that the tenancy has access to the model.
- For 429: add backoff/retry or reduce batch frequency.
- For 404: confirm the modelId and region in the endpoint URL match a model your compartment can serve.
Defensive patterns
Strategy: retry
Try / catch
from litellm.exceptions import litellm as _l # generic
try:
resp = litellm.embedding(model="oci/...", input=texts)
except Exception as e:
code = getattr(e, "status_code", None)
if code == 429:
backoff_and_retry() # rate limited
elif code in (401, 403):
audit_oci_credentials() # config problem, do not retry
else:
raise Prevention
- Check e.status_code to branch: 429 retry, 4xx fix config, 5xx alert
- Verify OCI_COMPARTMENT_ID and model entitlement before bulk runs
- Read the raw OCI error body in the message for the precise cause
When it happens
Trigger: Invalid OCI credentials (401), wrong compartment OCID (404), model not entitled to your tenancy (403), rate limiting (429), or OCI service errors (5xx) — any non-200 from the embedText call. The status_code on the raised OCIError mirrors the upstream status.
Common situations: Expired or misconfigured OCI config file / API keys, using an ON_DEMAND model the tenancy has not accepted terms for, wrong region in the api_base, or throttling during bulk embedding runs.
Related errors
- {str(e)}
- {err.response.text}
- error_msg (upstream response error message)
- {e.response.text}
- {response.text}
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/ff87bbda70688c77.
Report an issue: GitHub.