{"record":{"id":"55ee6b6dcf9b3d85","repo":"run-llama/llama_index","slug":"simplegraphstore-does-not-support-get-schema","errorCode":null,"errorMessage":"SimpleGraphStore does not support get_schema","messagePattern":"SimpleGraphStore does not support get_schema","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/graph_stores/simple.py","lineNumber":155,"sourceCode":"                    del self._data.graph_dict[subj]\n\n    def persist(\n        self,\n        persist_path: str = os.path.join(DEFAULT_PERSIST_DIR, DEFAULT_PERSIST_FNAME),\n        fs: Optional[fsspec.AbstractFileSystem] = None,\n    ) -> None:\n        \"\"\"Persist the SimpleGraphStore to a directory.\"\"\"\n        fs = fs or self._fs\n        dirpath = os.path.dirname(persist_path)\n        if not fs.exists(dirpath):\n            fs.makedirs(dirpath)\n\n        with fs.open(persist_path, \"w\", encoding=\"utf-8\") as f:\n            json.dump(self._data.to_dict(), f)\n\n    def get_schema(self, refresh: bool = False) -> str:\n        \"\"\"Get the schema of the Simple Graph store.\"\"\"\n        raise NotImplementedError(\"SimpleGraphStore does not support get_schema\")\n\n    def query(self, query: str, param_map: Optional[Dict[str, Any]] = {}) -> Any:\n        \"\"\"Query the Simple Graph store.\"\"\"\n        raise NotImplementedError(\"SimpleGraphStore does not support query\")\n\n    @classmethod\n    def from_persist_path(\n        cls, persist_path: str, fs: Optional[fsspec.AbstractFileSystem] = None\n    ) -> \"SimpleGraphStore\":\n        \"\"\"Create a SimpleGraphStore from a persist directory.\"\"\"\n        fs = fs or fsspec.filesystem(\"file\")\n        if not fs.exists(persist_path):\n            logger.warning(\n                f\"No existing {__name__} found at {persist_path}. \"\n                \"Initializing a new graph_store from scratch. \"\n            )\n            return cls()\n","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/graph_stores/simple.py#L137-L173","documentation":"SimpleGraphStore.get_schema() unconditionally raises NotImplementedError. SimpleGraphStore is an in-memory/dict-backed triple store (subject-predicate-object maps persisted as JSON); it has no schema concept and no query language, so the base GraphStore interface methods it cannot honor are explicitly stubbed out with clear errors rather than returning fake data.","triggerScenarios":"Calling graph_store.get_schema() on a store created via SimpleGraphStore() or SimpleGraphStore.from_persist_path(...) — typically generic code (e.g. a KnowledgeGraphIndex/RAG flow that introspects the store's schema, or PropertyGraphIndex scaffolding) that assumes a full graph-database backend like Neo4j.","commonSituations":"Prototyping with the default simple store and then wiring in code written against Neo4jGraphStore/NeptuneGraphStore; LLM agents calling get_schema() to build prompts; swapping store implementations via config without adjusting the query layer.","solutions":["Use a real graph backend that implements get_schema — e.g. Neo4jGraphStore, NebulaGraphStore, or another integration package.","If you only need triple storage/retrieval, call SimpleGraphStore's supported methods (get/upsert triple(s), get_triplets) instead of get_schema.","Feature-detect before calling: skip schema introspection when isinstance(store, SimpleGraphStore) or when the method raises NotImplementedError."],"exampleFix":"# before\nschema = graph_store.get_schema()  # SimpleGraphStore -> NotImplementedError\n\n# after\ntry:\n    schema = graph_store.get_schema(refresh=True)\nexcept NotImplementedError:\n    schema = \"\"  # simple in-memory store has no schema","handlingStrategy":"fallback","validationCode":"from llama_index.core.graph_stores.simple import SimpleGraphStore\n\nschema = \"\" if isinstance(graph_store, SimpleGraphStore) else graph_store.get_schema(refresh=True)","typeGuard":"def supports_schema(store) -> bool:\n    return not isinstance(store, (SimpleGraphStore, SimplePropertyGraphStore))","tryCatchPattern":"try:\n    schema = graph_store.get_schema(refresh=True)\nexcept NotImplementedError:\n    schema = \"\"  # in-memory stores carry no schema","preventionTips":["Feature-check the store class before schema introspection.","Choose a graph-database backend when schema-driven prompting is required.","Centralize store capability detection in one adapter used by all retrievers."],"tags":["not-implemented","graph-store","unsupported-operation","in-memory"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}