{"record":{"id":"4c4231ba0407b27c","repo":"BerriAI/litellm","slug":"response-text-4c4231","errorCode":null,"errorMessage":"{response_text}","messagePattern":"\\{response_text\\}","errorType":"http","errorClass":"CohereError","httpStatus":null,"severity":"error","filePath":"litellm/llms/cohere/rerank/transformation.py","lineNumber":147,"sourceCode":"        self,\n        model: str,\n        raw_response: httpx.Response,\n        model_response: RerankResponse,\n        logging_obj: LiteLLMLoggingObj,\n        api_key: str | None = None,\n        request_data: dict = {},\n        optional_params: dict = {},\n        litellm_params: dict = {},\n    ) -> RerankResponse:\n        \"\"\"\n        Transform Cohere rerank response\n\n        No transformation required, litellm follows cohere API response format\n        \"\"\"\n        try:\n            raw_response_json: Final = raw_response.json()\n        except Exception:\n            raise CohereError(message=raw_response.text, status_code=raw_response.status_code)\n\n        return RerankResponse(**raw_response_json)\n\n    def get_error_class(self, error_message: str, status_code: int, headers: dict | httpx.Headers) -> BaseLLMException:\n        return CohereError(message=error_message, status_code=status_code)\n","sourceCodeStart":129,"sourceCodeEnd":153,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/cohere/rerank/transformation.py#L129-L153","documentation":"Response-parsing failure in Cohere rerank: raw_response.json() raised (non-JSON body), so the raw response text is re-raised as the CohereError message — typically an HTML/XML error page or truncated body from the rerank endpoint.","triggerScenarios":"Thrown at litellm/llms/cohere/rerank/transformation.py:147 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the response text in the error; the Cohere rerank API rejected the request (commonly auth, model name, or payload shape).","Verify COHERE_API_KEY is valid and the model (e.g. rerank-v3.5) is available on your plan."],"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-14T05:17:10.506Z"}