{"record":{"id":"b937f59c7fb84743","repo":"run-llama/llama_index","slug":"to-dict-only-available-when-using-simple-doc-index","errorCode":null,"errorMessage":"to_dict only available when using simple doc/index/vector stores","messagePattern":"to_dict only available when using simple doc/index/vector stores","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/storage/storage_context.py","lineNumber":217,"sourceCode":"                    / f\"{vector_store_name}{NAMESPACE_SEP}{vector_store_fname}\"\n                )\n\n            vector_store.persist(persist_path=vector_store_path, fs=fs)\n\n    def to_dict(self) -> dict:\n        all_simple = (\n            isinstance(self.docstore, SimpleDocumentStore)\n            and isinstance(self.index_store, SimpleIndexStore)\n            and isinstance(self.graph_store, SimpleGraphStore)\n            and isinstance(\n                self.property_graph_store, (SimplePropertyGraphStore, type(None))\n            )\n            and all(\n                isinstance(vs, SimpleVectorStore) for vs in self.vector_stores.values()\n            )\n        )\n        if not all_simple:\n            raise ValueError(\n                \"to_dict only available when using simple doc/index/vector stores\"\n            )\n\n        assert isinstance(self.docstore, SimpleDocumentStore)\n        assert isinstance(self.index_store, SimpleIndexStore)\n        assert isinstance(self.graph_store, SimpleGraphStore)\n        assert isinstance(\n            self.property_graph_store, (SimplePropertyGraphStore, type(None))\n        )\n\n        return {\n            VECTOR_STORE_KEY: {\n                key: vector_store.to_dict()\n                for key, vector_store in self.vector_stores.items()\n                if isinstance(vector_store, SimpleVectorStore)\n            },\n            DOC_STORE_KEY: self.docstore.to_dict(),\n            INDEX_STORE_KEY: self.index_store.to_dict(),","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/storage/storage_context.py#L199-L235","documentation":"Error \"to_dict only available when using simple doc/index/vector stores\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/storage/storage_context.py:217 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the default simple docstore/index store/vector store if you need to_dict serialization.","Persist each store with its own persist() method instead of to_dict."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}