{"record":{"id":"00af4db7f8bc4d98","repo":"run-llama/llama_index","slug":"delete-not-implemented-for-struct-store-index","errorCode":null,"errorMessage":"Delete not implemented for Struct Store Index.","messagePattern":"Delete not implemented for Struct Store Index\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/indices/struct_store/base.py","lineNumber":63,"sourceCode":"        index_struct: Optional[BST] = None,\n        schema_extract_prompt: Optional[BasePromptTemplate] = None,\n        output_parser: Optional[OUTPUT_PARSER_TYPE] = None,\n        **kwargs: Any,\n    ) -> None:\n        \"\"\"Initialize params.\"\"\"\n        self.schema_extract_prompt = (\n            schema_extract_prompt or DEFAULT_SCHEMA_EXTRACT_PROMPT\n        )\n        self.output_parser = output_parser or default_output_parser\n        super().__init__(\n            nodes=nodes,\n            index_struct=index_struct,\n            **kwargs,\n        )\n\n    def _delete_node(self, node_id: str, **delete_kwargs: Any) -> None:\n        \"\"\"Delete a node.\"\"\"\n        raise NotImplementedError(\"Delete not implemented for Struct Store 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(\"Struct Store Index does not support ref_doc_info.\")\n","sourceCodeStart":45,"sourceCodeEnd":69,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/indices/struct_store/base.py#L45-L69","documentation":"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.","triggerScenarios":"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.","commonSituations":"Generic document-management code written against VectorStoreIndex being reused for SQL-backed indexes; calling index.delete_refdoc after re-ingesting documents.","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)"],"exampleFix":"# before\nindex.delete(node_id)  # raises NotImplementedError on StructStoreIndex\n\n# after\nindex = GPTSQLStructStoreIndex(sql_database, tables=['my_table'])  # rebuild from source data","handlingStrategy":"type-guard","validationCode":"from llama_index.core.indices.struct_store.base import StructStoreIndex\nif not isinstance(index, StructStoreIndex):\n    index.delete(node_id)\nelse:\n    logger.warning('node deletion unsupported; rebuild StructStoreIndex from source data')","typeGuard":"def supports_node_deletion(index) -> bool:\n    from llama_index.core.indices.struct_store.base import StructStoreIndex\n    from llama_index.core.indices.property_graph import PropertyGraphIndex\n    return not isinstance(index, (StructStoreIndex, PropertyGraphIndex))","tryCatchPattern":"try:\n    index.delete(node_id)\nexcept NotImplementedError:\n    index = build_struct_store_index_from_source()  # rebuild path","preventionTips":["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"],"tags":["llama-index","struct-store","not-implemented","deletion"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}