{"record":{"id":"ab9c321cd5c97cc9","repo":"BerriAI/litellm","slug":"error-text-ab9c32","errorCode":null,"errorMessage":"error_text","messagePattern":"error_text","errorType":"exception","errorClass":"OpenAIError","httpStatus":null,"severity":"error","filePath":"litellm/llms/openai/completion/handler.py","lineNumber":163,"sourceCode":"                logging_obj.post_call(\n                    api_key=api_key,\n                    original_response=response_json,\n                    additional_args={\n                        \"headers\": headers,\n                        \"api_base\": api_base,\n                    },\n                )\n\n                ## RESPONSE OBJECT\n                return TextCompletionResponse(**response_json)\n        except Exception as e:\n            status_code: Final = getattr(e, \"status_code\", 500)\n            error_headers = getattr(e, \"headers\", None)\n            error_text: Final = getattr(e, \"text\", str(e))\n            error_response: Final = getattr(e, \"response\", None)\n            if error_headers is None and error_response:\n                error_headers = getattr(error_response, \"headers\", None)\n            raise OpenAIError(status_code=status_code, message=error_text, headers=error_headers)\n\n    async def acompletion(\n        self,\n        logging_obj,\n        api_base: str,\n        data: dict,\n        headers: dict,\n        model_response: ModelResponse,\n        api_key: str,\n        model: str,\n        timeout: float,\n        max_retries: int,\n        organization: str | None = None,\n        client=None,\n    ):\n        try:\n            if client is None:\n                openai_aclient = AsyncOpenAI(","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/openai/completion/handler.py#L145-L181","documentation":"Best-effort extraction of an error body from an arbitrary exception caught in the OpenAI completion handler: it pulls 'text' off the exception (falling back to a default) so the raised error carries the upstream response body. It represents a failed completion call where the provider exception is normalized into an OpenAIError with status, headers, and body text.","triggerScenarios":"Thrown at litellm/llms/openai/completion/handler.py:163 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the error text in the message; fix the request (auth, model, payload) as indicated."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}