{"record":{"id":"ef1c4401a3847367","repo":"run-llama/llama_index","slug":"ref-doc-info-not-implemented-for-propertygraphinde","errorCode":null,"errorMessage":"Ref doc info not implemented for PropertyGraphIndex. All inserts are already upserts.","messagePattern":"Ref doc info not implemented for PropertyGraphIndex\\. All inserts are already upserts\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/indices/property_graph/base.py","lineNumber":407,"sourceCode":"                        **kwargs,\n                    )\n                )\n\n        use_async_val = kwargs.pop(\"use_async\", self._use_async)\n        return PGRetriever(sub_retrievers, use_async=use_async_val, **kwargs)\n\n    def _delete_node(self, node_id: str, **delete_kwargs: Any) -> None:\n        \"\"\"Delete a node.\"\"\"\n        self.property_graph_store.delete(ids=[node_id])\n\n    def _insert(self, nodes: Sequence[BaseNode], **insert_kwargs: Any) -> None:\n        \"\"\"Index-specific logic for inserting nodes to the index struct.\"\"\"\n        self._insert_nodes(nodes)\n\n    @property\n    def ref_doc_info(self) -> Dict[str, RefDocInfo]:\n        \"\"\"Retrieve a dict mapping of ingested documents and their nodes+metadata.\"\"\"\n        raise NotImplementedError(\n            \"Ref doc info not implemented for PropertyGraphIndex. \"\n            \"All inserts are already upserts.\"\n        )\n","sourceCodeStart":389,"sourceCodeEnd":411,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/indices/property_graph/base.py#L389-L411","documentation":"PropertyGraphIndex.ref_doc_info deliberately raises NotImplementedError: because every insert into a property graph is an upsert (nodes are keyed by ID, not tracked per source document), the index cannot reconstruct a mapping of ingested documents to their nodes.","triggerScenarios":"Accessing index.ref_doc_info on a PropertyGraphIndex, or calling APIs that internally consult ref_doc_info (e.g. some delete/document-tracking utilities, index.ref_doc_info property access).","commonSituations":"Porting code written for VectorStoreIndex/SummaryIndex that used ref_doc_info for document management; building document-deletion workflows that assume per-doc node tracking.","solutions":["Query the graph store directly, e.g. property_graph_store.get(properties={'ref_doc_id': doc_id}) to find nodes derived from a document","Maintain your own doc-id -> node-id mapping at insert time","Switch to VectorStoreIndex if per-document node tracking is a hard requirement","Guard access with isinstance(index, PropertyGraphIndex) checks in shared code paths"],"exampleFix":"# before\ninfo = index.ref_doc_info  # raises on PropertyGraphIndex\n\n# after\nnodes = index.property_graph_store.get(properties={\"ref_doc_id\": doc_id})","handlingStrategy":"type-guard","validationCode":"from llama_index.core.indices.property_graph import PropertyGraphIndex\nif isinstance(index, PropertyGraphIndex):\n    nodes = index.property_graph_store.get(properties={'ref_doc_id': doc_id})\nelse:\n    info = index.ref_doc_info","typeGuard":"def safe_ref_doc_info(index) -> dict:\n    from llama_index.core.indices.property_graph import PropertyGraphIndex\n    if isinstance(index, PropertyGraphIndex):\n        return {}  # not supported; upserts only\n    return index.ref_doc_info","tryCatchPattern":"try:\n    info = index.ref_doc_info\nexcept NotImplementedError:\n    info = {}  # property graph indexes: track docs yourself","preventionTips":["Abstract document tracking behind your own interface instead of relying on ref_doc_info across index types","Record doc_id -> node_ids at ingestion time for property graphs"],"tags":["llama-index","property-graph","not-implemented","api-limitation"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}