run-llama/llama_index · error · NotImplementedError

Struct Store Index does not support ref_doc_info.

Error message

Struct Store Index does not support ref_doc_info.

What it means

StructStoreIndex does not track which nodes came from which source document — its index struct holds table containers built from a database/schema, not per-document node mappings — so the ref_doc_info property always raises NotImplementedError.

Source

Thrown at llama-index-core/llama_index/core/indices/struct_store/base.py:68

        """Initialize params."""
        self.schema_extract_prompt = (
            schema_extract_prompt or DEFAULT_SCHEMA_EXTRACT_PROMPT
        )
        self.output_parser = output_parser or default_output_parser
        super().__init__(
            nodes=nodes,
            index_struct=index_struct,
            **kwargs,
        )

    def _delete_node(self, node_id: str, **delete_kwargs: Any) -> None:
        """Delete a node."""
        raise NotImplementedError("Delete not implemented for Struct Store Index.")

    @property
    def ref_doc_info(self) -> Dict[str, RefDocInfo]:
        """Retrieve a dict mapping of ingested documents and their nodes+metadata."""
        raise NotImplementedError("Struct Store Index does not support ref_doc_info.")

View on GitHub (pinned to afd0fef371)

Solutions

  1. Remove ref_doc_info usage for struct-store indexes; source-of-truth is the underlying SQL database or JSON document
  2. Track ingested sources yourself (e.g. persist the list of tables/JSON docs you built the index from)
  3. Use VectorStoreIndex when per-document provenance is required

Example fix

# before
info = index.ref_doc_info  # raises on StructStoreIndex

# after
tables = index.sql_database.get_usable_table_names()  # introspect source instead
Defensive patterns

Strategy: type-guard

Validate before calling

from llama_index.core.indices.struct_store.base import StructStoreIndex
if isinstance(index, StructStoreIndex):
    sources = index.sql_database.get_usable_table_names()
else:
    info = index.ref_doc_info

Type guard

def has_ref_doc_info(index) -> bool:
    from llama_index.core.indices.struct_store.base import StructStoreIndex
    from llama_index.core.indices.property_graph import PropertyGraphIndex
    return not isinstance(index, (StructStoreIndex, PropertyGraphIndex))

Try / catch

try:
    info = index.ref_doc_info
except NotImplementedError:
    info = {}  # struct-store indexes track no per-doc info

Prevention

When it happens

Trigger: Accessing index.ref_doc_info (or calling helpers like index.delete_ref_doc / document-tracking utilities that consult it) on GPTSQLStructStoreIndex, GPTJSONIndex, or other StructStoreIndex subclasses.

Common situations: Porting ingestion/audit dashboards from VectorStoreIndex that enumerate ref_doc_info; generic code that lists ingested documents across mixed indexes.

Related errors


AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15). Data as JSON: /api/errors/7710f60169a88c3e. Report an issue: GitHub.