{"record":{"id":"72595024dd2af10c","repo":"run-llama/llama_index","slug":"this-query-engine-does-not-support-asynthesize-us","errorCode":null,"errorMessage":"This query engine does not support asynthesize, use aquery directly","messagePattern":"This query engine does not support asynthesize, use aquery directly","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/base/base_query_engine.py","lineNumber":83,"sourceCode":"        )\n\n    def synthesize(\n        self,\n        query_bundle: QueryBundle,\n        nodes: List[NodeWithScore],\n        additional_source_nodes: Optional[Sequence[NodeWithScore]] = None,\n    ) -> RESPONSE_TYPE:\n        raise NotImplementedError(\n            \"This query engine does not support synthesize, use query directly\"\n        )\n\n    async def asynthesize(\n        self,\n        query_bundle: QueryBundle,\n        nodes: List[NodeWithScore],\n        additional_source_nodes: Optional[Sequence[NodeWithScore]] = None,\n    ) -> RESPONSE_TYPE:\n        raise NotImplementedError(\n            \"This query engine does not support asynthesize, use aquery directly\"\n        )\n\n    @abstractmethod\n    def _query(self, query_bundle: QueryBundle) -> RESPONSE_TYPE:\n        pass\n\n    @abstractmethod\n    async def _aquery(self, query_bundle: QueryBundle) -> RESPONSE_TYPE:\n        pass\n","sourceCodeStart":65,"sourceCodeEnd":94,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/base/base_query_engine.py#L65-L94","documentation":"asynthesize() is the async stub mirroring synthesize(): the base query engine does not expose two-phase synthesis, and _aquery does retrieval+synthesis together. Any call to asynthesize on a stock engine raises NotImplementedError with guidance to use aquery.","triggerScenarios":"Awaiting query_engine.asynthesize(query_bundle, nodes) on any standard query engine; async pipelines that retrieved nodes separately and then try to synthesize via the engine.","commonSituations":"Async refactors of two-phase RAG code; generic async pipeline abstractions that call asynthesize uniformly; confusing the engine with ResponseSynthesizer.asynthesize (which does exist).","solutions":["Use the one-shot async API: response = await query_engine.aquery(query_bundle).","For separate async phases, use a ResponseSynthesizer directly: await synth.asynthesize(query_bundle, nodes).","Override asynthesize in a custom engine subclass only if you deliberately implement two-phase behavior."],"exampleFix":"# before\nresponse = await query_engine.asynthesize(query_bundle, nodes)  # NotImplementedError\n\n# after\nfrom llama_index.core.response_synthesizers import get_response_synthesizer\nsynth = get_response_synthesizer(llm=llm)\nresponse = await synth.asynthesize(query_bundle, nodes)","handlingStrategy":"type-guard","validationCode":"from llama_index.core.base.query_engine import BaseQueryEngine\n\nasync def answer(obj, query_bundle):\n    if isinstance(obj, BaseQueryEngine):\n        return await obj.aquery(query_bundle)  # never call asynthesize on engines","typeGuard":"from llama_index.core.response_synthesizers.base import BaseSynthesizer\n\nasync def can_asynthesize(obj) -> bool:\n    return isinstance(obj, BaseSynthesizer)","tryCatchPattern":null,"preventionTips":["Call await engine.aquery(...) for combined retrieval+synthesis.","Call await synth.asynthesize(...) on a ResponseSynthesizer for the synthesis-only phase.","Keep async pipelines typed so engine/synthesizer mix-ups surface in review."],"tags":["query-engine","api-misuse","async","response-synthesis"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}