microsoft/graphrag · error · RuntimeError

No follow-up queries found in primer response. Ensure that t

Error message

No follow-up queries found in primer response. Ensure that the primer response includes follow-up queries.

What it means

After extracting intermediate answers from the primer response, DRIFT search requires follow_up_queries entries to drive its iterative refinement loop. If every item in the parsed response omits follow_up_queries (or all are empty lists), this RuntimeError is raised because the search cannot proceed to its next step.

Source

Thrown at packages/graphrag/graphrag/query/structured_search/drift_search/search.py:147

        response = search_results.response
        if isinstance(response, list) and isinstance(response[0], dict):
            intermediate_answers = [
                i["intermediate_answer"] for i in response if "intermediate_answer" in i
            ]

            if not intermediate_answers:
                error_msg = "No intermediate answers found in primer response. Ensure that the primer response includes intermediate answers."
                raise RuntimeError(error_msg)

            intermediate_answer = "\n\n".join([
                i["intermediate_answer"] for i in response if "intermediate_answer" in i
            ])

            follow_ups = [fu for i in response for fu in i.get("follow_up_queries", [])]

            if not follow_ups:
                error_msg = "No follow-up queries found in primer response. Ensure that the primer response includes follow-up queries."
                raise RuntimeError(error_msg)

            score = sum(i.get("score", float("-inf")) for i in response) / len(response)
            response_data = {
                "intermediate_answer": intermediate_answer,
                "follow_up_queries": follow_ups,
                "score": score,
            }
            return DriftAction.from_primer_response(query, response_data)
        error_msg = "Response must be a list of dictionaries."
        raise ValueError(error_msg)

    async def _search_step(
        self,
        global_query: str,
        k_followups: int,
        search_engine: LocalSearch,
        actions: list[DriftAction],
    ) -> list[DriftAction]:

View on GitHub (pinned to f40e9a26ce)

Solutions

  1. Retry the search; models intermittently omit fields
  2. Use a stronger instruction-following model for the primer step
  3. Restore/verify the default DRIFT primer prompt includes explicit follow_up_queries instructions if you customized it
  4. Increase output token limits to prevent truncation before follow-ups are generated
Defensive patterns

Strategy: retry

Type guard

def has_follow_ups(response) -> bool:
    return any(i.get("follow_up_queries") for i in response if isinstance(i, dict))

Try / catch

for attempt in range(3):
    try:
        result = await drift_search.aresolve(query)
        break
    except RuntimeError as e:
        if "follow-up queries" in str(e) and attempt < 2:
            continue
        raise

Prevention

When it happens

Trigger: Calling DriftSearch.search where the primer LLM response parses successfully but contains no follow_up_queries keys or only empty lists, often because the model skipped that part of the instructed output schema.

Common situations: Weak or small models ignoring the multi-field JSON instruction, customized primer prompts that dropped the follow-up instructions, or truncated responses that cut off before follow-up queries were emitted.

Related errors


AI-assisted analysis of microsoft/graphrag@f40e9a26ce (2026-08-27). Data as JSON: /api/errors/c64d278953649171. Report an issue: GitHub.