{"record":{"id":"f89f26d1e1083c80","repo":"microsoft/graphrag","slug":"the-sum-of-community-prop-and-text-unit-prop-shoul","errorCode":null,"errorMessage":"The sum of community_prop and text_unit_prop should not exceed 1.","messagePattern":"The sum of community_prop and text_unit_prop should not exceed 1\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/graphrag/graphrag/query/structured_search/local_search/mixed_context.py","lineNumber":129,"sourceCode":"        min_community_rank: int = 0,\n        community_context_name: str = \"Reports\",\n        column_delimiter: str = \"|\",\n        **kwargs: dict[str, Any],\n    ) -> ContextBuilderResult:\n        \"\"\"\n        Build data context for local search prompt.\n\n        Build a context by combining community reports and entity/relationship/covariate tables, and text units using a predefined ratio set by summary_prop.\n        \"\"\"\n        if include_entity_names is None:\n            include_entity_names = []\n        if exclude_entity_names is None:\n            exclude_entity_names = []\n        if community_prop + text_unit_prop > 1:\n            value_error = (\n                \"The sum of community_prop and text_unit_prop should not exceed 1.\"\n            )\n            raise ValueError(value_error)\n\n        # map user query to entities\n        # if there is conversation history, attached the previous user questions to the current query\n        if conversation_history:\n            pre_user_questions = \"\\n\".join(\n                conversation_history.get_user_turns(conversation_history_max_turns)\n            )\n            query = f\"{query}\\n{pre_user_questions}\"\n\n        selected_entities = map_query_to_entities(\n            query=query,\n            text_embedding_vectorstore=self.entity_text_embeddings,\n            text_embedder=self.text_embedder,\n            all_entities_dict=self.entities,\n            embedding_vectorstore_key=self.embedding_vectorstore_key,\n            include_entity_names=include_entity_names,\n            exclude_entity_names=exclude_entity_names,\n            k=top_k_mapped_entities,","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/microsoft/graphrag/blob/f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704/packages/graphrag/graphrag/query/structured_search/local_search/mixed_context.py#L111-L147","documentation":"LocalSearch's mixed context builder allocates context budget between community data and text units using community_prop and text_unit_prop. Their sum must not exceed 1 (they are fractions of the total budget); if community_prop + text_unit_prop > 1, build_context raises this ValueError immediately.","triggerScenarios":"Calling LocalSearch.search/stream_search or MixedContext.build_context with community_prop + text_unit_prop > 1, e.g. community_prop=0.3 and text_unit_prop=0.9, either via constructor arguments or settings.yaml (local_search.community_prop / local_search.text_unit_prop).","commonSituations":"Tuning local_search settings in settings.yaml and raising one proportion without lowering the other, copying example configs with incompatible values, or passing both props programmatically with a typo (e.g. 0.8 + 0.5).","solutions":["Lower one or both values so community_prop + text_unit_prop <= 1 (e.g. defaults 0.15 + 0.75 = 0.9)","Fix settings.yaml local_search.community_prop and local_search.text_unit_prop to sum to at most 1","If constructing MixedContext/LocalSearch in code, validate the props against your constants before instantiating"],"exampleFix":"# before\nsearch = LocalSearch(\n    ...,\n    context_builder=...\n)  # settings.yaml: community_prop: 0.3, text_unit_prop: 0.9\n\n# after\n# settings.yaml\nlocal_search:\n  community_prop: 0.3\n  text_unit_prop: 0.7","handlingStrategy":"validation","validationCode":"community_prop, text_unit_prop = 0.3, 0.7\nassert community_prop + text_unit_prop <= 1, \"community_prop + text_unit_prop must be <= 1\"\nsearch = LocalSearch(..., community_prop=community_prop, text_unit_prop=text_unit_prop)","typeGuard":"def valid_props(community_prop: float, text_unit_prop: float) -> bool:\n    return 0 <= community_prop <= 1 and 0 <= text_unit_prop <= 1 and community_prop + text_unit_prop <= 1","tryCatchPattern":null,"preventionTips":["Document and validate your local_search settings at config load time","When tuning one prop, adjust the other to keep the sum <= 1","Prefer the library defaults (0.15/0.75) unless you have measured a reason to change them"],"tags":["graphrag","local-search","config-validation","proportion"],"backgroundTag":"config-validation-failed","analyzedSha":"f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704","analyzedAt":"2026-08-27T11:16:29.677Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}