crewAIInc/crewAI · error · RuntimeError

Reranker API returned status {result.status_code}: {result.t

Error message

Reranker API returned status {result.status_code}: {result.text}

What it means

Error "Reranker API returned status {result.status_code}: {result.text}" thrown in crewAIInc/crewAI.

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/contextualai_rerank_tool/contextual_rerank_tool.py:74

            payload = {"query": query, "documents": documents, "model": model}

            if instruction:
                payload["instruction"] = instruction

            if metadata:
                if len(metadata) != len(documents):
                    raise ValueError(
                        "Metadata list must have the same length as documents list"
                    )
                payload["metadata"] = metadata

            rerank_url = f"{base_url}/rerank"
            result = requests.post(
                rerank_url, json=payload, headers=headers, timeout=30
            )

            if result.status_code != 200:
                raise RuntimeError(
                    f"Reranker API returned status {result.status_code}: {result.text}"
                )

            return json.dumps(result.json(), indent=2)

        except Exception as e:
            return f"Failed to rerank documents: {e!s}"

View on GitHub (pinned to 754d7323be)

Solutions

  1. Check your Contextual AI API key and request payload.
  2. Retry the request or reduce batch size if the API is rate-limiting.

When it happens

Trigger: Thrown at lib/crewai-tools/src/crewai_tools/tools/contextualai_rerank_tool/contextual_rerank_tool.py:74 when the library encounters an invalid state.

Common situations: Occurs when the Contextual AI reranker API returns a non-success status. Check the API key, request payload, and service availability.


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/285ac6dab7554d55. Report an issue: GitHub.