{"record":{"id":"a685f338fab5a417","repo":"run-llama/llama_index","slug":"no-source-nodes-passed-evaluation","errorCode":null,"errorMessage":"No source nodes passed evaluation.","messagePattern":"No source nodes passed evaluation\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/query_engine/retry_source_query_engine.py","lineNumber":77,"sourceCode":"        else:\n            logger.debug(\"Evaluation returned False.\")\n            # Test source nodes\n            source_evals = [\n                self._evaluator.evaluate(\n                    query=query_str,\n                    response=typed_response.response,\n                    contexts=[source_node.get_content()],\n                )\n                for source_node in typed_response.source_nodes\n            ]\n            orig_nodes = typed_response.source_nodes\n            assert len(source_evals) == len(orig_nodes)\n            new_docs = []\n            for node, eval_result in zip(orig_nodes, source_evals):\n                if eval_result:\n                    new_docs.append(Document(text=node.node.get_content()))\n            if len(new_docs) == 0:\n                raise ValueError(\"No source nodes passed evaluation.\")\n            new_index = SummaryIndex.from_documents(\n                new_docs,\n            )\n            new_retriever_engine = RetrieverQueryEngine(new_index.as_retriever())\n            new_query_engine = RetrySourceQueryEngine(\n                new_retriever_engine,\n                self._evaluator,\n                self._llm,\n                self.max_retries - 1,\n            )\n            return new_query_engine.query(query_bundle)\n\n    async def _aquery(self, query_bundle: QueryBundle) -> RESPONSE_TYPE:\n        \"\"\"Not supported.\"\"\"\n        return self._query(query_bundle)\n","sourceCodeStart":59,"sourceCodeEnd":93,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/query_engine/retry_source_query_engine.py#L59-L93","documentation":"RetrySourceQueryEngine evaluates each retrieved source node with a relevance evaluator and keeps only nodes that pass. If every node fails evaluation, there is nothing left to build a refined SummaryIndex from, so it raises ValueError('No source nodes passed evaluation.') before attempting another retry round.","triggerScenarios":"Constructing RetrySourceQueryEngine(retriever_query_engine, evaluator, llm, max_retries=N) and calling .query() where the evaluator (e.g. RelevancyEvaluator) judges all retrieved source nodes as irrelevant to the query.","commonSituations":"Retriever returns off-topic chunks (poor index quality, wrong embedding model, chunking mismatch), an overly strict relevancy evaluator/LLM, or a query that genuinely has no answer in the indexed corpus.","solutions":["Improve retrieval quality: check index contents, embedding model, top_k, and chunking so relevant nodes are actually retrieved","Lower evaluator strictness (e.g. a more lenient LLM or custom evaluator prompt) so borderline-relevant nodes pass","Wrap the query call in try/except ValueError and surface a 'no relevant sources' answer to the user instead of crashing"],"exampleFix":"// before\nresponse = retry_engine.query(\"What is the refund policy?\")\n\n// after\ntry:\n    response = retry_engine.query(\"What is the refund policy?\")\nexcept ValueError as e:\n    if \"No source nodes passed evaluation\" in str(e):\n        response = Response(\"No relevant sources were found for this question.\")\n    else:\n        raise","handlingStrategy":"try-catch","validationCode":"# Pre-check: evaluate retrieval yourself is costly; instead validate corpus coverage\n# cheap sanity check that the index is non-empty and top-k retrieval returns nodes\nnodes = retriever_query_engine.retrieve(QueryBundle(query_str=q))\nif not nodes:\n    raise RuntimeError(\"Retriever returned nothing; fix index before using RetrySourceQueryEngine\")","typeGuard":null,"tryCatchPattern":"from llama_index.core.response.schema import Response\n\ntry:\n    resp = retry_engine.query(q)\nexcept ValueError as e:\n    if \"No source nodes passed evaluation\" in str(e):\n        resp = Response(\n            \"No relevant sources were found for this question.\",\n            source_nodes=[],\n        )\n    else:\n        raise","preventionTips":["Verify index quality with a few probe queries before adding retry/evaluator layers","Keep max_retries small (1-2) and always catch ValueError as the terminal 'retries exhausted' signal","Tune evaluator prompt/LLM strictness if legitimate sources are being rejected"],"tags":["retrieval","evaluation","retry","relevancy"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}