graphrag icon indicating copy to clipboard operation
graphrag copied to clipboard

[Bug]: KeyError: '\n "title"' during community report extraction

Open TimMolleman opened this issue 1 month ago • 0 comments

Do you need to file an issue?

  • [x] I have searched the existing issues and this bug is not already filed.
  • [x] My model is hosted on OpenAI or Azure. If not, please look at the "model providers" issue and don't file a new one here.
  • [x] I believe this is a legitimate bug, not just a question. If this is a question, please use the Discussions area.

Describe the bug

At the graphrag.index.operations.summarize_communities.community_reports_extractor step, I sometimes get an error:

Traceback (most recent call last): File "/home/admin/code/graphrag-build-update/.venv/lib/python3.12/site-packages/graphrag/index/operations/summarize_communities/community_reports_extractor.py", line 76, in __call__ prompt = self._extraction_prompt.format(**{ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: '\n "title"'

What happens during auto-prompt tuning is that the tuned 'community_report_text.txt' contains both double {{}} and single {} for formatting placeholders sometimes, probably due to the LLM making a mistake during tuning. In those cases, the above-mentioned step goes wrong and the whole process stops. We now fix this by manually making all {{}} single (so {}), but I can imagine that it's preferable to fix this in the actual graphrag package.

Also see this issue which was marked stale, which seems to be the same issue: https://github.com/microsoft/graphrag/issues/1912.

Steps to reproduce

No response

Expected Behavior

No response

GraphRAG Config Used

# Paste your config here

Logs and screenshots

No response

Additional Information

  • GraphRAG Version:
  • Operating System:
  • Python Version:
  • Related Issues:

TimMolleman avatar Nov 27 '25 10:11 TimMolleman