run-llama/llama_index · error · ValueError

to_dict only available when using simple doc/index/vector st

Error message

to_dict only available when using simple doc/index/vector stores

What it means

Error "to_dict only available when using simple doc/index/vector stores" thrown in run-llama/llama_index.

Source

Thrown at llama-index-core/llama_index/core/storage/storage_context.py:217

                    / f"{vector_store_name}{NAMESPACE_SEP}{vector_store_fname}"
                )

            vector_store.persist(persist_path=vector_store_path, fs=fs)

    def to_dict(self) -> dict:
        all_simple = (
            isinstance(self.docstore, SimpleDocumentStore)
            and isinstance(self.index_store, SimpleIndexStore)
            and isinstance(self.graph_store, SimpleGraphStore)
            and isinstance(
                self.property_graph_store, (SimplePropertyGraphStore, type(None))
            )
            and all(
                isinstance(vs, SimpleVectorStore) for vs in self.vector_stores.values()
            )
        )
        if not all_simple:
            raise ValueError(
                "to_dict only available when using simple doc/index/vector stores"
            )

        assert isinstance(self.docstore, SimpleDocumentStore)
        assert isinstance(self.index_store, SimpleIndexStore)
        assert isinstance(self.graph_store, SimpleGraphStore)
        assert isinstance(
            self.property_graph_store, (SimplePropertyGraphStore, type(None))
        )

        return {
            VECTOR_STORE_KEY: {
                key: vector_store.to_dict()
                for key, vector_store in self.vector_stores.items()
                if isinstance(vector_store, SimpleVectorStore)
            },
            DOC_STORE_KEY: self.docstore.to_dict(),
            INDEX_STORE_KEY: self.index_store.to_dict(),

View on GitHub (pinned to afd0fef371)

Solutions

  1. Use the default simple docstore/index store/vector store if you need to_dict serialization.
  2. Persist each store with its own persist() method instead of to_dict.

When it happens

Trigger: Thrown at llama-index-core/llama_index/core/storage/storage_context.py:217 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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