{"record":{"id":"490a9778eef96896","repo":"HKUDS/DeepTutor","slug":"graphrag-model-incompatible-490a97","errorCode":"graphrag_model_incompatible","errorMessage":"GraphRAG structured response validation failed.","messagePattern":"GraphRAG structured response validation failed\\.","errorType":"exception","errorClass":"GraphRagStructuredOutputError","httpStatus":null,"severity":"error","filePath":"deeptutor/services/rag/pipelines/graphrag/engine.py","lineNumber":171,"sourceCode":"        CommunityReportResponse,\n    )\n\n\nasync def _validate_probe_completion(completion: Any, response_model: type) -> None:\n    \"\"\"Request and validate one minimal GraphRAG community-report response.\"\"\"\n    response = await completion.completion_async(\n        messages=(\n            \"Return one concise community report for a graph containing one topic named \"\n            \"'compatibility test'. Include a title, summary, one finding with summary and \"\n            \"explanation, a numeric rating, and a rating explanation.\"\n        ),\n        response_format=response_model,\n        max_tokens=PROBE_MAX_TOKENS,\n        stream=False,\n        timeout=PROBE_TIMEOUT_SECONDS,\n    )\n    if not isinstance(getattr(response, \"formatted_response\", None), response_model):\n        raise GraphRagStructuredOutputError(\"GraphRAG structured response validation failed.\")\n\n\nasync def _probe_completion_model_impl(llm_cfg: Any) -> None:\n    \"\"\"Probe a resolved DeepTutor model through the GraphRAG adapter.\"\"\"\n    await _validate_probe_completion(*_create_probe_completion(llm_cfg))\n\n\ndef _failed_probe_result(llm_cfg: Any, error: Exception) -> dict[str, Any]:\n    \"\"\"Classify a probe failure without returning provider messages or credentials.\"\"\"\n    classified = classify_model_error(error)\n    if isinstance(\n        classified,\n        (GraphRagModelIncompatibleError, GraphRagUnsupportedProviderError),\n    ):\n        status = \"incompatible\"\n        compatible: bool | None = False\n    else:\n        status = \"unverifiable\"","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/services/rag/pipelines/graphrag/engine.py#L153-L189","documentation":"GraphRagStructuredOutputError (code graphrag_model_incompatible) raised in _validate_probe_completion: the probe completion call returned, but response.formatted_response is not an instance of the expected pydantic response_model — the structured-output validation failed even though the HTTP call succeeded.","triggerScenarios":"Running the GraphRAG completion preflight (_probe_completion_model_impl / _preflight_completion_impl) against a model that returns unparsable or schema-mismatched output within the probe's max_tokens/timeout budget.","commonSituations":"Pre-flight checks when setting up a GraphRAG KB with a model that ignores response_format; proxies stripping structured-output fields; models returning wrapped/markdown-fenced JSON.","solutions":["Switch to a model with native structured-output support.","Raise PROBE_MAX_TOKENS if output is being cut (causing invalid formatted_response).","Verify any intermediary proxy forwards response_format and returns choices[0].message content intact."],"exampleFix":"# before: probe against model without response_format support\nspec = load_model(\"my-local-7b\")\n# after\nspec = load_model(\"deepseek-chat\")  # verified structured output","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    await preflight_completion(root)\nexcept GraphRagStructuredOutputError as e:\n    if e.code == \"graphrag_model_incompatible\":\n        select_structured_output_model()\n    raise","preventionTips":["Run the probe before committing to a model for GraphRAG indexing."],"tags":["graphrag","preflight","structured-output","llm"],"backgroundTag":"llm-structured-output-invalid","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}