BerriAI/litellm · error · HuggingFaceError
{text}
Error message
{text} What it means
Error "{text}" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/huggingface/rerank/transformation.py:181
request_body.update(optional_rerank_params)
return request_body
def transform_rerank_response(
self,
model: str,
raw_response: httpx.Response,
model_response: RerankResponse,
logging_obj: LoggingClass,
api_key: str | None = None,
request_data: dict = {},
optional_params: dict = {},
litellm_params: dict = {},
) -> RerankResponse:
try:
raw_response_json: Final[HuggingFaceRerankResponseList] = raw_response.json()
except Exception:
raise HuggingFaceError(
message=getattr(raw_response, "text", str(raw_response)),
status_code=getattr(raw_response, "status_code", 500),
)
# Use standard litellm token counter for proper token estimation
input_text = request_data.get("query", "")
try:
# Calculate tokens for the raw response JSON string
response_text: Final = str(raw_response_json)
estimated_output_tokens = token_counter(model=model, text=response_text)
# Calculate input tokens from query and documents
query: Final = request_data.get("query", "")
documents: Final = request_data.get("texts", [])
# Convert documents to string if they're not already
documents_text = ""
for doc in documents:View on GitHub (pinned to 77b7c6c40c)
Solutions
- Read the text from the HuggingFace rerank response included in the exception; verify the reranker endpoint and payload.
When it happens
Trigger: Thrown at litellm/llms/huggingface/rerank/transformation.py:181 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/54404d3836ced3ec.
Report an issue: GitHub.