{"record":{"id":"79f2a7a8cccf68ca","repo":"run-llama/llama_index","slug":"cannot-specify-both-query-str-and-query-bundle","errorCode":null,"errorMessage":"Cannot specify both query_str and query_bundle","messagePattern":"Cannot specify both query_str and query_bundle","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/postprocessor/rankGPT_rerank.py","lineNumber":99,"sourceCode":"\n        items = {\n            \"query\": query_bundle.query_str,\n            \"hits\": [{\"content\": node.get_content()} for node in nodes],\n        }\n\n        messages = self.create_permutation_instruction(item=items)\n        permutation = await self.arun_llm(messages=messages)\n        return self._llm_result_to_nodes(permutation, nodes, items)\n\n    async def apostprocess_nodes(\n        self,\n        nodes: List[NodeWithScore],\n        query_bundle: Optional[QueryBundle] = None,\n        query_str: Optional[str] = None,\n    ) -> List[NodeWithScore]:\n        \"\"\"Postprocess nodes asynchronously.\"\"\"\n        if query_str is not None and query_bundle is not None:\n            raise ValueError(\"Cannot specify both query_str and query_bundle\")\n        elif query_str is not None:\n            query_bundle = QueryBundle(query_str)\n        else:\n            pass\n        return await self._apostprocess_nodes(nodes, query_bundle)\n\n    def _llm_result_to_nodes(\n        self, permutation: ChatResponse, nodes: List[NodeWithScore], items: Dict\n    ) -> List[NodeWithScore]:\n        if permutation.message is not None and permutation.message.content is not None:\n            rerank_ranks = self._receive_permutation(\n                items, str(permutation.message.content)\n            )\n            if self.verbose:\n                print_text(f\"After Reranking, new rank list for nodes: {rerank_ranks}\")\n\n            initial_results: List[NodeWithScore] = []\n","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/postprocessor/rankGPT_rerank.py#L81-L117","documentation":"Error \"Cannot specify both query_str and query_bundle\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/postprocessor/rankGPT_rerank.py:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass either query_str or query_bundle, not both.","Remove one of the two arguments from the rerank call."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}