{"record":{"id":"aaa8740ae67b3fde","repo":"BerriAI/litellm","slug":"no-results-found-in-the-response-raw-response-jso","errorCode":null,"errorMessage":"No results found in the response={raw_response_json}","messagePattern":"No results found in the response=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/fireworks_ai/rerank/transformation.py","lineNumber":217,"sourceCode":"        #     \"prompt_tokens\": 50,\n        #     \"completion_tokens\": 50\n        #   }\n        # }\n\n        # Extract usage information\n        usage: Final = raw_response_json.get(\"usage\", {})\n        _billed_units: Final = RerankBilledUnits(search_units=usage.get(\"total_tokens\", 0))\n        _tokens: Final = RerankTokens(\n            input_tokens=usage.get(\"prompt_tokens\", 0),\n            output_tokens=usage.get(\"completion_tokens\", 0),\n        )\n        rerank_meta: Final = RerankResponseMeta(billed_units=_billed_units, tokens=_tokens)\n\n        # Extract results - Fireworks AI uses \"data\" instead of \"results\"\n        _results: Final[list[dict] | None] = raw_response_json.get(\"data\") or raw_response_json.get(\"results\")\n\n        if _results is None:\n            raise ValueError(f\"No results found in the response={raw_response_json}\")\n\n        rerank_results: Final[list[RerankResponseResult]] = []\n\n        for result in _results:\n            # Validate required fields exist\n            if not all(key in result for key in [\"index\", \"relevance_score\"]):\n                raise ValueError(f\"Missing required fields in the result={result}\")\n\n            # Get document data - Fireworks AI returns document as a string directly\n            document_text = result.get(\"document\")\n            document = None\n            if document_text:\n                # Handle both string and object formats\n                if isinstance(document_text, str):\n                    document = RerankResponseDocument(text=document_text)\n                elif isinstance(document_text, dict):\n                    # Handle object format if it exists\n                    text = document_text.get(\"text\", \"\")","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/fireworks_ai/rerank/transformation.py#L199-L235","documentation":"While transforming a Fireworks rerank response, litellm looks for ranked items under the 'data' key (Fireworks' native shape) and falls back to 'results'. If neither key exists (or both are null), it raises ValueError with the full raw response JSON so the caller can see what Fireworks actually returned.","triggerScenarios":"Fireworks returns an error-shaped JSON (e.g. an error field with 200 status), an empty body, or changes/removes the data/results field; also triggered by mocked tests that return a response without 'data'/'results'.","commonSituations":"A provider-side API change or incident where the rerank endpoint's response schema drifts; a proxy in front of Fireworks that rewrites the body; unit tests with hand-crafted fixture JSON that omits the results array.","solutions":["Inspect the raw JSON embedded in the message to see what Fireworks returned (often an auth/quota error surfaced with HTTP 200).","Retry once — a truncated or incident-degraded response is frequently transient.","If the schema genuinely changed, pin/upgrade the litellm version that tracks the current Fireworks rerank response format and update test fixtures to include a 'data' array."],"exampleFix":"# before (test fixture lacking results)\nmock_response = {\"id\": \"resp_1\", \"model\": \"qwen3-reranker-8b\"}\n\n# after\nmock_response = {\n    \"id\": \"resp_1\",\n    \"model\": \"qwen3-reranker-8b\",\n    \"data\": [{\"index\": 0, \"relevance_score\": 0.93}],\n    \"usage\": {\"total_tokens\": 10},\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"def has_rerank_payload(raw: dict) -> bool:\n    results = raw.get(\"data\") or raw.get(\"results\")\n    return isinstance(results, list)","tryCatchPattern":"try:\n    result = litellm.rerank(model=\"fireworks_ai/...\", query=q, documents=docs)\nexcept ValueError as e:\n    if \"No results found in the response\" in str(e):\n        logging.error(\"Fireworks rerank returned unparseable body: %s\", e)\n        return fallback_no_rerank(docs)  # e.g. original ordering\n    raise","preventionTips":["Log the full error message — it embeds the raw response for post-mortem.","Keep rerank fixtures (with a 'data' array) in tests so schema drift is caught locally first.","Stay on a recent litellm patch release when Fireworks changes response shapes."],"tags":["fireworks-ai","rerank","response-parsing","schema-drift"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}