run-llama/llama_index · error · NotImplementedError
Delete not implemented for Struct Store Index.
Error message
Delete not implemented for Struct Store Index.
What it means
StructStoreIndex (base class for SQL/JSON GPT index variants) has no node-level deletion: _delete_node unconditionally raises NotImplementedError. The index struct (table containers) does not map deletable nodes, so the base delete machinery cannot apply.
Source
Thrown at llama-index-core/llama_index/core/indices/struct_store/base.py:63
index_struct: Optional[BST] = None,
schema_extract_prompt: Optional[BasePromptTemplate] = None,
output_parser: Optional[OUTPUT_PARSER_TYPE] = None,
**kwargs: Any,
) -> None:
"""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
- Do not call node deletion on struct-store indexes; rebuild the index from the updated database/JSON instead
- For SQL indexes, change the data in the database itself and re-create the index
- Branch on index type in shared pipelines: skip deletion when isinstance(index, StructStoreIndex)
Example fix
# before index.delete(node_id) # raises NotImplementedError on StructStoreIndex # after index = GPTSQLStructStoreIndex(sql_database, tables=['my_table']) # rebuild from source data
Defensive patterns
Strategy: type-guard
Validate before calling
from llama_index.core.indices.struct_store.base import StructStoreIndex
if not isinstance(index, StructStoreIndex):
index.delete(node_id)
else:
logger.warning('node deletion unsupported; rebuild StructStoreIndex from source data') Type guard
def supports_node_deletion(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:
index.delete(node_id)
except NotImplementedError:
index = build_struct_store_index_from_source() # rebuild path Prevention
- Gate deletion operations behind an index-capability check in shared code
- Model struct-store indexes as views over a database: mutate the DB, then rebuild
When it happens
Trigger: Calling index.delete(node_id), index.delete_nodes([...]), or any API that funnels into _delete_node on a GPTSQLStructStoreIndex/GPTStructStoreIndex/JSON index; also refresh workflows that try to remove stale nodes.
Common situations: Generic document-management code written against VectorStoreIndex being reused for SQL-backed indexes; calling index.delete_refdoc after re-ingesting documents.
Related errors
- Struct Store Index does not support ref_doc_info.
- Cannot insert into an empty index.
- Cannot delete from an empty index.
- ref_doc_info not supported for an empty index.
- Delete is not supported for KG index yet.
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/00af4db7f8bc4d98.
Report an issue: GitHub.