{"record":{"id":"3c24eae63ea11695","repo":"BerriAI/litellm","slug":"no-results-found-in-the-response-json-response","errorCode":null,"errorMessage":"No results found in the response={_json_response}","messagePattern":"No results found in the response=(.+?)","errorType":"http","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/jina_ai/rerank/transformation.py","lineNumber":111,"sourceCode":"        request_data: dict = {},\n        optional_params: dict = {},\n        litellm_params: dict = {},\n    ) -> RerankResponse:\n        if raw_response.status_code != 200:\n            raise Exception(raw_response.text)\n\n        logging_obj.post_call(original_response=raw_response.text)\n\n        _json_response: Final = raw_response.json()\n\n        _billed_units: Final = RerankBilledUnits(**_json_response.get(\"usage\", {}))\n        _tokens: Final = RerankTokens(**_json_response.get(\"usage\", {}))\n        rerank_meta: Final = RerankResponseMeta(billed_units=_billed_units, tokens=_tokens)\n\n        _results: Final[list[dict] | None] = _json_response.get(\"results\")\n\n        if _results is None:\n            raise ValueError(f\"No results found in the response={_json_response}\")\n\n        # Transform Jina AI's response format to match LiteLLM's expected format\n        # Jina AI returns: {\"index\": 0, \"relevance_score\": 0.72, \"document\": \"hello\"}\n        # LiteLLM expects: {\"index\": 0, \"relevance_score\": 0.72, \"document\": {\"text\": \"hello\"}}\n        transformed_results: Final = []\n        for result in _results:\n            transformed_result = {\n                \"index\": result[\"index\"],\n                \"relevance_score\": result[\"relevance_score\"],\n            }\n            # Convert document from string to dict format if it exists\n            if \"document\" in result and isinstance(result[\"document\"], str):\n                transformed_result[\"document\"] = {\"text\": result[\"document\"]}\n            elif \"document\" in result:\n                # If it's already a dict, keep it as is\n                transformed_result[\"document\"] = result[\"document\"]\n            transformed_results.append(transformed_result)\n","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/jina_ai/rerank/transformation.py#L93-L129","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Upgrade litellm to the latest version so the Jina transformation matches the current API shape.","Log the full _json_response to see what top-level keys arrived.","If an intermediary proxy modifies responses, bypass or fix it for this route."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"def jina_body_has_results(json_body: object) -> bool:\n    return isinstance(json_body, dict) and isinstance(json_body.get('results'), list)","tryCatchPattern":"try:\n    ranked = litellm.rerank(model='jina_ai/...', query=q, documents=docs)\nexcept ValueError as e:\n    if 'No results found in the response' in str(e):\n        logger.error('Jina schema drift: %s', e)\n        raise RuntimeError('jina response schema changed; upgrade litellm') from e\n    raise","preventionTips":["Pin and regularly upgrade litellm when using jina_ai","Add a contract test asserting results is present in one live rerank response per release"],"tags":["jina-ai","rerank","response-format","schema-drift"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}