run-llama/llama_index · error · NotImplementedError

This query engine does not support asynthesize, use aquery…

Error message

This query engine does not support asynthesize, use aquery directly

What it means

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.

Solutions

  1. Use the one-shot async API: response = await query_engine.aquery(query_bundle).
  2. For separate async phases, use a ResponseSynthesizer directly: await synth.asynthesize(query_bundle, nodes).
  3. Override asynthesize in a custom engine subclass only if you deliberately implement two-phase behavior.

Example fix

# before
response = await query_engine.asynthesize(query_bundle, nodes)  # NotImplementedError

# after
from llama_index.core.response_synthesizers import get_response_synthesizer
synth = get_response_synthesizer(llm=llm)
response = await synth.asynthesize(query_bundle, nodes)
Defensive patterns

Strategy: type-guard

Validate before calling

from llama_index.core.base.query_engine import BaseQueryEngine

async def answer(obj, query_bundle):
    if isinstance(obj, BaseQueryEngine):
        return await obj.aquery(query_bundle)  # never call asynthesize on engines

Type guard

from llama_index.core.response_synthesizers.base import BaseSynthesizer

async def can_asynthesize(obj) -> bool:
    return isinstance(obj, BaseSynthesizer)

Prevention

When it happens

Trigger: 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.

Common situations: Async refactors of two-phase RAG code; generic async pipeline abstractions that call asynthesize uniformly; confusing the engine with ResponseSynthesizer.asynthesize (which does exist).

Related errors


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

Appendix: source

Thrown at llama-index-core/llama_index/core/base/base_query_engine.py:83

        )

    def synthesize(
        self,
        query_bundle: QueryBundle,
        nodes: List[NodeWithScore],
        additional_source_nodes: Optional[Sequence[NodeWithScore]] = None,
    ) -> RESPONSE_TYPE:
        raise NotImplementedError(
            "This query engine does not support synthesize, use query directly"
        )

    async def asynthesize(
        self,
        query_bundle: QueryBundle,
        nodes: List[NodeWithScore],
        additional_source_nodes: Optional[Sequence[NodeWithScore]] = None,
    ) -> RESPONSE_TYPE:
        raise NotImplementedError(
            "This query engine does not support asynthesize, use aquery directly"
        )

    @abstractmethod
    def _query(self, query_bundle: QueryBundle) -> RESPONSE_TYPE:
        pass

    @abstractmethod
    async def _aquery(self, query_bundle: QueryBundle) -> RESPONSE_TYPE:
        pass

View on GitHub (pinned to afd0fef371)