{"record":{"id":"f9a1c936cc9f67f3","repo":"run-llama/llama_index","slug":"ref-doc-info-not-supported-for-an-empty-index","errorCode":null,"errorMessage":"ref_doc_info not supported for an empty index.","messagePattern":"ref_doc_info not supported for an empty index\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/indices/empty/base.py","lineNumber":91,"sourceCode":"            IndexList: The created summary index.\n\n        \"\"\"\n        del nodes  # Unused\n        return EmptyIndexStruct()\n\n    def _insert(self, nodes: Sequence[BaseNode], **insert_kwargs: Any) -> None:\n        \"\"\"Insert a document.\"\"\"\n        del nodes  # Unused\n        raise NotImplementedError(\"Cannot insert into an empty index.\")\n\n    def _delete_node(self, node_id: str, **delete_kwargs: Any) -> None:\n        \"\"\"Delete a node.\"\"\"\n        raise NotImplementedError(\"Cannot delete from an empty index.\")\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(\"ref_doc_info not supported for an empty index.\")\n\n\n# legacy\nGPTEmptyIndex = EmptyIndex\n","sourceCodeStart":73,"sourceCodeEnd":96,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/indices/empty/base.py#L73-L96","documentation":"ref_doc_info maps ingested source documents to their nodes and metadata — a concept that cannot exist for an index that ingests nothing. EmptyIndex implements the ref_doc_info property as a raise, so even reading it (not calling it) raises NotImplementedError.","triggerScenarios":"Accessing empty_index.ref_doc_info (property access, no call); generic bookkeeping code that iterates index.ref_doc_info to list ingested docs; calling index_utils helpers like get_node_list/get_source_doc_info on an EmptyIndex.","commonSituations":"Admin dashboards showing which documents each index contains; document-sync tooling that diffs ref_doc_info against an external store; reusable maintenance scripts applied to every index in a registry.","solutions":["Guard property access: check isinstance(index, EmptyIndex) (or try/except NotImplementedError) before touching ref_doc_info.","Track ingested document metadata externally (your DB/docstore) when an EmptyIndex may be in play, since the index itself cannot report it.","Use a data-bearing index (SummaryIndex/VectorStoreIndex) if introspection of ingested docs is a requirement."],"exampleFix":"// before\ninfo = index.ref_doc_info  # raises on EmptyIndex\n\n// after\nfrom llama_index.core.indices.empty import EmptyIndex\ninfo = {} if isinstance(index, EmptyIndex) else index.ref_doc_info","handlingStrategy":"type-guard","validationCode":"from llama_index.core.indices.empty import EmptyIndex\n\ninfo = {} if isinstance(index, EmptyIndex) else index.ref_doc_info","typeGuard":"from llama_index.core.indices.empty import EmptyIndex\n\ndef has_ref_doc_info(index: object) -> bool:\n    return not isinstance(index, EmptyIndex)","tryCatchPattern":"try:\n    info = index.ref_doc_info\nexcept NotImplementedError:\n    info = {}  # empty/managed index: no ingested doc info","preventionTips":["Access ref_doc_info only through a helper that understands your index registry.","Keep document metadata in your own store when EmptyIndex is possible.","Remember it is a property — a try block around the attribute read, not a call."],"tags":["llama-index","empty-index","not-implemented","property"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}