{"record":{"id":"59be9f8aa98f1c1c","repo":"BerriAI/litellm","slug":"no-results-found-in-the-response-json-response-59be9f","errorCode":null,"errorMessage":"No results found in the response={_json_response}","messagePattern":"No results found in the response=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/voyage/rerank/transformation.py","lineNumber":106,"sourceCode":"        litellm_params: dict = {},\n    ) -> RerankResponse:\n        if raw_response.status_code != 200:\n            raise VoyageError(message=raw_response.text, status_code=raw_response.status_code)\n\n        logging_obj.post_call(original_response=raw_response.text)\n\n        try:\n            _json_response: Final = raw_response.json()\n        except Exception:\n            raise VoyageError(\n                message=f\"Failed to parse response: {raw_response.text}\",\n                status_code=raw_response.status_code,\n            )\n\n        # Voyage AI returns results in \"data\" key, not \"results\"\n        _results: Final[list[dict] | None] = _json_response.get(\"data\")\n        if _results is None:\n            raise ValueError(f\"No results found in the response={_json_response}\")\n\n        # Transform to LiteLLM format\n        transformed_results: Final = []\n        for result in _results:\n            transformed_result: dict[str, Any] = {\n                \"index\": result[\"index\"],\n                \"relevance_score\": result[\"relevance_score\"],\n            }\n            if \"document\" in result:\n                if isinstance(result[\"document\"], str):\n                    transformed_result[\"document\"] = {\"text\": result[\"document\"]}\n                else:\n                    transformed_result[\"document\"] = result[\"document\"]\n            transformed_results.append(transformed_result)\n\n        usage: Final = _json_response.get(\"usage\", {})\n        total_tokens: Final = usage.get(\"total_tokens\", 0)\n        _billed_units: Final = RerankBilledUnits(total_tokens=total_tokens)","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/voyage/rerank/transformation.py#L88-L124","documentation":"Voyage's rerank API returns results under a \"data\" key (not OpenAI's \"results\"). After successfully parsing the JSON, the transformer checks _json_response.get(\"data\"); if the key is absent or None, this ValueError is raised. It means the request reached Voyage and a JSON body came back, but the payload does not contain the expected results array - an API contract change, an error body with 200, or an unexpected model response.","triggerScenarios":"Voyage changes/renames the response field; an error payload {\"error\": ...} delivered with status 200; pointing litellm at a custom api_base whose rerank endpoint returns {\"results\": [...]} in OpenAI shape instead of Voyage shape; extremely large document lists returning an empty object.","commonSituations":"Version drift between litellm's Voyage adapter and the live Voyage API; gateway middleware rewrapping responses; custom rerank backends that mimic OpenAI rather than Voyage.","solutions":["Inspect the full JSON printed in the exception message to see the actual payload shape.","Upgrade (or pin) litellm to a version matching the Voyage rerank API contract you target.","If using a custom api_base, make sure it exposes Voyage-shaped responses ({\"data\": [...]}) or switch the model to the matching provider prefix.","Report/check the Voyage changelog if the payload is an unexpected error body with status 200."],"exampleFix":"# before (custom endpoint returns OpenAI-shaped {\"results\": [...]})\nresult = litellm.rerank(model=\"voyage/my-reranker\", query=q, documents=docs, api_base=\"https://gw.internal\")\n# -> ValueError: No results found in the response={'results': [...]}\n\n# after (use the provider whose response shape the endpoint returns)\nresult = litellm.rerank(model=\"openai/my-reranker\" if using_openai_shape else \"voyage/my-reranker\", query=q, documents=docs, api_base=\"https://gw.internal\")","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = litellm.rerank(model=\"voyage/voyage-3-rerank\", query=q, documents=docs)\nexcept ValueError as e:\n    if \"No results found in the response\" in str(e):\n        logging.error(\"Voyage rerank payload missing 'data': %s\", e)\n        # surface as a typed upstream-contract error, not a crash\n        raise UpstreamContractError(\"voyage rerank schema changed\") from e\n    raise","preventionTips":["Pin the litellm version you validated against each provider API.","Wrap provider calls in an adapter layer so schema drift becomes one fix point.","Monitor for this error after Voyage API announcements; add it to alerting."],"tags":["voyage","rerank","response-schema","response-parsing","litellm"],"backgroundTag":"unexpected-response-schema","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}