{"record":{"id":"142c3546e5be77bb","repo":"BerriAI/litellm","slug":"no-results-in-dashscope-rerank-response-response","errorCode":null,"errorMessage":"No results in DashScope rerank response: {response_json}","messagePattern":"No results in DashScope rerank response: (.+?)","errorType":"http","errorClass":"DashScopeError","httpStatus":null,"severity":"error","filePath":"litellm/llms/dashscope/rerank/transformation.py","lineNumber":194,"sourceCode":"            )\n\n        logging_obj.post_call(\n            input=request_data.get(\"query\"),\n            api_key=api_key,\n            additional_args={\"complete_input_dict\": request_data},\n            original_response=response_json,\n        )\n\n        # DashScope error envelope: {\"code\": \"...\", \"message\": \"...\", \"request_id\": \"...\"}\n        if \"code\" in response_json and \"results\" not in response_json:\n            raise DashScopeError(\n                status_code=raw_response.status_code,\n                message=response_json.get(\"message\", str(response_json)),\n            )\n\n        results: Final = response_json.get(\"results\")\n        if results is None:\n            raise DashScopeError(\n                status_code=raw_response.status_code,\n                message=f\"No results in DashScope rerank response: {response_json}\",\n            )\n\n        # qwen3-rerank returns:\n        #   {\"index\": int, \"relevance_score\": float}\n        # plus, when return_documents=true was sent:\n        #   \"document\": {\"text\": \"...\"}\n        # which already matches LiteLLM's RerankResponseDocument shape.\n        transformed_results: Final[list[dict]] = []\n        for r in results:\n            item: dict[str, Any] = {\n                \"index\": r[\"index\"],\n                \"relevance_score\": r[\"relevance_score\"],\n            }\n            doc = r.get(\"document\")\n            if isinstance(doc, dict):\n                item[\"document\"] = doc","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/dashscope/rerank/transformation.py#L176-L212","documentation":"Raised when a DashScope rerank response parses as JSON, contains no error envelope, but is missing the 'results' key entirely (results is None). This is an unexpected/contract-violating response shape, and the full response body is embedded in the exception message for diagnosis.","triggerScenarios":"DashScope returns 200 with an atypical body: a partial/degraded response during incidents, a new API version changing the response schema, or an endpoint that ignores the rerank path and returns a generic payload.","commonSituations":"DashScope service degradation; hitting a base URL that serves a different API surface; DashScope shipping a schema change that LiteLLM has not yet adapted to (version skew between litellm and the API).","solutions":["Log the full response body included in the message to see what DashScope actually returned","Reproduce with a minimal curl request to the rerank endpoint to check the raw schema","Retry once — degraded responses are often transient","If the schema genuinely changed, upgrade litellm to the latest patch where the transformer may be fixed, or report the response shape to the litellm repo"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.rerank(model=m, query=q, documents=docs)\nexcept Exception as e:\n    if \"No results in DashScope rerank response\" in str(e):\n        logger.warning(\"rerank degraded, falling back to original order: %s\", e)\n        return docs  # fallback: unranked documents\n    raise","preventionTips":["Design the RAG pipeline so rerank is an optional stage with a pass-through fallback","Alert on missing-'results' responses as an early signal of DashScope schema drift or degradation"],"tags":["dashscope","rerank","response-schema","upstream-error"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}