{"record":{"id":"54404d3836ced3ec","repo":"BerriAI/litellm","slug":"text","errorCode":null,"errorMessage":"{text}","messagePattern":"\\{text\\}","errorType":"exception","errorClass":"HuggingFaceError","httpStatus":null,"severity":"error","filePath":"litellm/llms/huggingface/rerank/transformation.py","lineNumber":181,"sourceCode":"        request_body.update(optional_rerank_params)\n\n        return request_body\n\n    def transform_rerank_response(\n        self,\n        model: str,\n        raw_response: httpx.Response,\n        model_response: RerankResponse,\n        logging_obj: LoggingClass,\n        api_key: str | None = None,\n        request_data: dict = {},\n        optional_params: dict = {},\n        litellm_params: dict = {},\n    ) -> RerankResponse:\n        try:\n            raw_response_json: Final[HuggingFaceRerankResponseList] = raw_response.json()\n        except Exception:\n            raise HuggingFaceError(\n                message=getattr(raw_response, \"text\", str(raw_response)),\n                status_code=getattr(raw_response, \"status_code\", 500),\n            )\n\n        # Use standard litellm token counter for proper token estimation\n        input_text = request_data.get(\"query\", \"\")\n        try:\n            # Calculate tokens for the raw response JSON string\n            response_text: Final = str(raw_response_json)\n            estimated_output_tokens = token_counter(model=model, text=response_text)\n\n            # Calculate input tokens from query and documents\n            query: Final = request_data.get(\"query\", \"\")\n            documents: Final = request_data.get(\"texts\", [])\n\n            # Convert documents to string if they're not already\n            documents_text = \"\"\n            for doc in documents:","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/huggingface/rerank/transformation.py#L163-L199","documentation":"Error \"{text}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/huggingface/rerank/transformation.py:181 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the text from the HuggingFace rerank response included in the exception; verify the reranker endpoint and payload."],"exampleFix":null,"handlingStrategy":null,"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-14T00:17:10.932Z"}