{"record":{"id":"814fc0e068befd25","repo":"run-llama/llama_index","slug":"invalid-docstore-strategy-effective-strategy","errorCode":null,"errorMessage":"Invalid docstore strategy: {effective_strategy}","messagePattern":"Invalid docstore strategy: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/ingestion/pipeline.py","lineNumber":536,"sourceCode":"    def _update_docstore(\n        self,\n        nodes: Sequence[BaseNode],\n        effective_strategy: DocstoreStrategy,\n        store_doc_text: bool = True,\n    ) -> None:\n        \"\"\"Update the document store with the given nodes.\"\"\"\n        assert self.docstore is not None\n\n        if effective_strategy in (\n            DocstoreStrategy.UPSERTS,\n            DocstoreStrategy.UPSERTS_AND_DELETE,\n        ):\n            self.docstore.set_document_hashes({n.id_: n.hash for n in nodes})\n            self.docstore.add_documents(nodes, store_text=store_doc_text)\n        elif effective_strategy == DocstoreStrategy.DUPLICATES_ONLY:\n            self.docstore.add_documents(nodes, store_text=store_doc_text)\n        else:\n            raise ValueError(f\"Invalid docstore strategy: {effective_strategy}\")\n\n    @dispatcher.span\n    def run(\n        self,\n        show_progress: bool = False,\n        documents: Optional[List[Document]] = None,\n        nodes: Optional[Sequence[BaseNode]] = None,\n        cache_collection: Optional[str] = None,\n        in_place: bool = True,\n        store_doc_text: bool = True,\n        num_workers: Optional[int] = None,\n        **kwargs: Any,\n    ) -> Sequence[BaseNode]:\n        \"\"\"\n        Run a series of transformations on a set of nodes.\n\n        If a vector store is provided, nodes with embeddings will be added to the vector store.\n","sourceCodeStart":518,"sourceCodeEnd":554,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/ingestion/pipeline.py#L518-L554","documentation":"Raised by IngestionPipeline's docstore-update step when the effective deduplication strategy is not one of the three DocstoreStrategy values (UPSERTS, DUPLICATES_ONLY, UPSERTS_AND_DELETE). The pipeline reads self.docstore_strategy (set at construction), so an arbitrary string or a mistyped value reaches this branch and is rejected before any docstore write.","triggerScenarios":"Constructing IngestionPipeline(docstore_strategy='upsert') (wrong spelling; valid value is 'upserts'), 'duplicates-only', or any custom string not in the enum, then calling pipeline.run() with both docstore and vector_store set. The strategy flows through as a raw string and falls into the else branch.","commonSituations":"Typos in the docstore_strategy string (the enum values are 'upserts', 'duplicates_only', 'upserts_and_delete'); passing a strategy name from an old llama-index version or blog post; building the strategy from dynamic config/CLI input without validation.","solutions":["Use the enum constant instead of a string: from llama_index.core.ingestion.pipeline import DocstoreStrategy; IngestionPipeline(docstore_strategy=DocstoreStrategy.UPSERTS).","If using strings, use exactly 'upserts', 'duplicates_only', or 'upserts_and_delete'.","Validate user-supplied strategy strings against DocstoreStrategy before constructing the pipeline."],"exampleFix":"# before\npipeline = IngestionPipeline(docstore_strategy='upsert', ...)  # typo -> ValueError on run()\n\n# after\nfrom llama_index.core.ingestion.pipeline import DocstoreStrategy\npipeline = IngestionPipeline(docstore_strategy=DocstoreStrategy.UPSERTS, ...)","handlingStrategy":"validation","validationCode":"from llama_index.core.ingestion.pipeline import DocstoreStrategy\nDocstoreStrategy(pipeline.docstore_strategy)  # raises early with a clear message","typeGuard":"def is_valid_strategy(s) -> bool:\n    try:\n        DocstoreStrategy(s)\n        return True\n    except ValueError:\n        return False","tryCatchPattern":"try:\n    pipeline.run(documents=docs)\nexcept ValueError as e:\n    if 'Invalid docstore strategy' in str(e):\n        pipeline.docstore_strategy = DocstoreStrategy.UPSERTS\n        pipeline.run(documents=docs)\n    else:\n        raise","preventionTips":["Always pass DocstoreStrategy enum members, never strings","Validate config-sourced strategy strings with DocstoreStrategy(value) at startup","Remember valid values: upserts, duplicates_only, upserts_and_delete"],"tags":["ingestion","pipeline","docstore","configuration"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}