BerriAI/litellm · error · ValueError

No results found in the response={_json_response}

Error message

No results found in the response={_json_response}

What it means

Raised when a Jina rerank response has HTTP 200 but its JSON body lacks a 'results' key (results is None). This indicates a schema change or an unexpected 200 response body (e.g. an error object without 'error' semantics), not an empty result set — an empty list would pass.

Source

Thrown at litellm/llms/jina_ai/rerank/transformation.py:111

        request_data: dict = {},
        optional_params: dict = {},
        litellm_params: dict = {},
    ) -> RerankResponse:
        if raw_response.status_code != 200:
            raise Exception(raw_response.text)

        logging_obj.post_call(original_response=raw_response.text)

        _json_response: Final = raw_response.json()

        _billed_units: Final = RerankBilledUnits(**_json_response.get("usage", {}))
        _tokens: Final = RerankTokens(**_json_response.get("usage", {}))
        rerank_meta: Final = RerankResponseMeta(billed_units=_billed_units, tokens=_tokens)

        _results: Final[list[dict] | None] = _json_response.get("results")

        if _results is None:
            raise ValueError(f"No results found in the response={_json_response}")

        # Transform Jina AI's response format to match LiteLLM's expected format
        # Jina AI returns: {"index": 0, "relevance_score": 0.72, "document": "hello"}
        # LiteLLM expects: {"index": 0, "relevance_score": 0.72, "document": {"text": "hello"}}
        transformed_results: Final = []
        for result in _results:
            transformed_result = {
                "index": result["index"],
                "relevance_score": result["relevance_score"],
            }
            # Convert document from string to dict format if it exists
            if "document" in result and isinstance(result["document"], str):
                transformed_result["document"] = {"text": result["document"]}
            elif "document" in result:
                # If it's already a dict, keep it as is
                transformed_result["document"] = result["document"]
            transformed_results.append(transformed_result)

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Upgrade litellm to the latest version so the Jina transformation matches the current API shape.
  2. Log the full _json_response to see what top-level keys arrived.
  3. If an intermediary proxy modifies responses, bypass or fix it for this route.
Defensive patterns

Strategy: type-guard

Type guard

def jina_body_has_results(json_body: object) -> bool:
    return isinstance(json_body, dict) and isinstance(json_body.get('results'), list)

Try / catch

try:
    ranked = litellm.rerank(model='jina_ai/...', query=q, documents=docs)
except ValueError as e:
    if 'No results found in the response' in str(e):
        logger.error('Jina schema drift: %s', e)
        raise RuntimeError('jina response schema changed; upgrade litellm') from e
    raise

Prevention

When it happens

Trigger: Jina API version drift returning a different top-level shape; a proxy between client and Jina rewriting the body; a 200 response carrying a status object instead of results.

Common situations: Long-running apps after Jina ships an API change; man-in-the-middle/SSO proxies altering payloads; pinned old litellm against a new Jina endpoint.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/3c24eae63ea11695. Report an issue: GitHub.