{"record":{"id":"e98734c0a38c1128","repo":"BerriAI/litellm","slug":"e-response-text-e98734","errorCode":null,"errorMessage":"{e.response.text}","messagePattern":"\\{e\\.response\\.text\\}","errorType":"exception","errorClass":"OCIError","httpStatus":null,"severity":"error","filePath":"litellm/llms/oci/chat/transformation.py","lineNumber":658,"sourceCode":"        messages: list,\n        client: HTTPHandler | AsyncHTTPHandler | None = None,\n        json_mode: bool | None = None,\n        signed_json_body: bytes | None = None,\n    ) -> \"OCIStreamWrapper\":\n        if client is None or isinstance(client, AsyncHTTPHandler):\n            client = _get_httpx_client(params={})\n\n        try:\n            response: Final = client.post(\n                api_base,\n                headers=headers,\n                data=(signed_json_body if signed_json_body is not None else json.dumps(data)),\n                stream=True,\n                logging_obj=logging_obj,\n                timeout=STREAMING_TIMEOUT,\n            )\n        except httpx.HTTPStatusError as e:\n            raise OCIError(status_code=e.response.status_code, message=e.response.text)\n\n        if response.status_code != 200:\n            raise OCIError(status_code=response.status_code, message=response.text)\n\n        return OCIStreamWrapper(\n            completion_stream=_iter_sse_events(response.iter_text()),\n            model=model,\n            custom_llm_provider=custom_llm_provider,\n            logging_obj=logging_obj,\n        )\n\n    @track_llm_api_timing()\n    async def get_async_custom_stream_wrapper(\n        self,\n        model: str,\n        custom_llm_provider: str,\n        logging_obj: LiteLLMLoggingObj,\n        api_base: str,","sourceCodeStart":640,"sourceCodeEnd":676,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/oci/chat/transformation.py#L640-L676","documentation":"Raised by OCIBaseTransformation.get_sync_custom_stream_wrapper when the synchronous streaming POST to the OCI Generative AI inference endpoint fails with an HTTP error status. The response body text from OCI is wrapped in an OCIError (a BaseLLMException subclass) carrying the upstream status code, so LiteLLM's standard exception mapping/logging can surface it.","triggerScenarios":"Calling litellm.completion(..., model='oci/...', stream=True) synchronously, where the signed POST to https://inference.generativeai.<region>.oci.oraclecloud.com returns a non-2xx or httpx raises HTTPStatusError: wrong model OCID, unauthorized signing (bad fingerprint/key), rate limiting (429), or a malformed request body rejected by the service.","commonSituations":"Typo'd model OCID; expired or mismatched RSA key fingerprint; region not entitled for the model; throttling under burst load; on-prem proxy returning 4xx. Note this except-branch is effectively dead code for plain client.post(stream=True) because httpx only raises HTTPStatusError after an explicit raise_for_status() call — non-200 statuses normally flow to the status_code check that raises the sibling error.","solutions":["Inspect the OCIError.status_code and message: 401/403 means signing credentials are wrong, 404 means model OCID or region is wrong, 429 means back off and retry.","Verify the model string uses a full OCID (ocid1.generativeai.model...) or an OCI-supported shorthand and that the region in the URL matches where the model is hosted.","Confirm oci_user/oci_fingerprint/oci_tenancy/oci_key (or env vars OCI_USER etc.) belong to the same tenancy that has access to the model.","For 429/5xx, retry with exponential backoff (litellm's built-in retry policy or your own)."],"exampleFix":"# before\nresp = litellm.completion(model=\"oci/cohere.command-r-plus\", messages=msgs, stream=True)\n\n# after — catch the mapped provider error\nimport litellm\nfrom litellm.llms.oci.common_utils import OCIError\ntry:\n    resp = litellm.completion(model=\"oci/cohere.command-r-plus\", messages=msgs, stream=True)\nexcept OCIError as e:\n    if e.status_code == 429:\n        time.sleep(2 ** attempt)\n    else:\n        raise","handlingStrategy":"try-catch","validationCode":"import os\nrequired = (\"OCI_USER\", \"OCI_FINGERPRINT\", \"OCI_TENANCY\")\nmissing = [v for v in required if not os.environ.get(v)]\nassert not missing and (os.environ.get(\"OCI_KEY\") or os.environ.get(\"OCI_KEY_FILE\")), f\"missing: {missing}\"","typeGuard":"from litellm.llms.oci.common_utils import OCIError\n\ndef is_oci_error(e: BaseException) -> bool:\n    return isinstance(e, OCIError)","tryCatchPattern":"from litellm.llms.oci.common_utils import OCIError\ntry:\n    stream = litellm.completion(model=\"oci/...\", messages=m, stream=True)\nexcept OCIError as e:\n    if e.status_code in (429,) or (e.status_code or 0) >= 500:\n        backoff_and_retry()\n    else:\n        raise  # 4xx = fix config/request, do not retry","preventionTips":["Validate OCI credentials and model OCID at startup with a 1-token dry-run call.","Keep credentials in env vars set by the deployment, not hardcoded defaults.","Retry only 429/5xx; treat 4xx as configuration bugs."],"tags":["oci","streaming","http","authentication","rate-limit"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}