{"record":{"id":"285ac6dab7554d55","repo":"crewAIInc/crewAI","slug":"reranker-api-returned-status-result-status-code","errorCode":null,"errorMessage":"Reranker API returned status {result.status_code}: {result.text}","messagePattern":"Reranker API returned status (.+?): (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/contextualai_rerank_tool/contextual_rerank_tool.py","lineNumber":74,"sourceCode":"            payload = {\"query\": query, \"documents\": documents, \"model\": model}\n\n            if instruction:\n                payload[\"instruction\"] = instruction\n\n            if metadata:\n                if len(metadata) != len(documents):\n                    raise ValueError(\n                        \"Metadata list must have the same length as documents list\"\n                    )\n                payload[\"metadata\"] = metadata\n\n            rerank_url = f\"{base_url}/rerank\"\n            result = requests.post(\n                rerank_url, json=payload, headers=headers, timeout=30\n            )\n\n            if result.status_code != 200:\n                raise RuntimeError(\n                    f\"Reranker API returned status {result.status_code}: {result.text}\"\n                )\n\n            return json.dumps(result.json(), indent=2)\n\n        except Exception as e:\n            return f\"Failed to rerank documents: {e!s}\"\n","sourceCodeStart":56,"sourceCodeEnd":82,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/contextualai_rerank_tool/contextual_rerank_tool.py#L56-L82","documentation":"Error \"Reranker API returned status {result.status_code}: {result.text}\" thrown in crewAIInc/crewAI.","triggerScenarios":"Thrown at lib/crewai-tools/src/crewai_tools/tools/contextualai_rerank_tool/contextual_rerank_tool.py:74 when the library encounters an invalid state.","commonSituations":"Occurs when the Contextual AI reranker API returns a non-success status. Check the API key, request payload, and service availability.","solutions":["Check your Contextual AI API key and request payload.","Retry the request or reduce batch size if the API is rate-limiting."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}