run-llama/llama_index · error · ValueError

Query bundle must be provided.

Error message

Query bundle must be provided.

What it means

Error "Query bundle must be provided." thrown in run-llama/llama_index.

Source

Thrown at llama-index-core/llama_index/core/postprocessor/llm_rerank.py:118

    ) -> List[NodeWithScore]:
        raw_choices, relevances = self._parse_choice_select_answer_fn(
            raw_response, len(nodes_batch)
        )
        choice_idxs = [int(choice) - 1 for choice in raw_choices]
        choice_nodes = [nodes_batch[idx] for idx in choice_idxs]
        relevances = relevances or [1.0 for _ in choice_nodes]
        return [
            NodeWithScore(node=node, score=relevance)
            for node, relevance in zip(choice_nodes, relevances)
        ]

    def _postprocess_nodes(
        self,
        nodes: List[NodeWithScore],
        query_bundle: Optional[QueryBundle] = None,
    ) -> List[NodeWithScore]:
        if query_bundle is None:
            raise ValueError("Query bundle must be provided.")
        if len(nodes) == 0:
            return []

        initial_results: List[NodeWithScore] = []
        for nodes_batch in self._get_node_batches(nodes):
            # call each batch independently
            raw_response = self.llm.predict(
                self.choice_select_prompt,
                **self._get_predict_kwargs(nodes_batch, query_bundle.query_str),
            )
            initial_results.extend(self._parse_raw_response(raw_response, nodes_batch))

        return sorted(initial_results, key=lambda x: x.score or 0.0, reverse=True)[
            : self.top_n
        ]

    async def _apostprocess_nodes(
        self,

View on GitHub (pinned to afd0fef371)

Solutions

  1. Pass a query_bundle when calling the LLMRerank postprocessor.
  2. Ensure the query bundle is forwarded through the query engine pipeline.

When it happens

Trigger: Thrown at llama-index-core/llama_index/core/postprocessor/llm_rerank.py:118 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15). Data as JSON: /api/errors/6308c5f4c19bbdd5. Report an issue: GitHub.