{"record":{"id":"4bfa4be44e5d2ef1","repo":"run-llama/llama_index","slug":"the-enum-value-self-is-not-compatible-with-compo","errorCode":null,"errorMessage":"The enum value {self} is not compatible with component of type {type(component)}","messagePattern":"The enum value (.+?) is not compatible with component of type (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/ingestion/data_sinks.py","lineNumber":43,"sourceCode":"class ConfigurableComponent(Enum):\n    @classmethod\n    def from_component(\n        cls, component: BasePydanticVectorStore\n    ) -> \"ConfigurableComponent\":\n        component_class = type(component)\n        for component_type in cls:\n            if component_type.value.component_type == component_class:\n                return component_type\n        raise ValueError(\n            f\"Component {component} is not a supported data sink component.\"\n        )\n\n    def build_configured_data_sink(\n        self, component: BasePydanticVectorStore\n    ) -> \"ConfiguredDataSink\":\n        component_type = self.value.component_type\n        if not isinstance(component, component_type):\n            raise ValueError(\n                f\"The enum value {self} is not compatible with component of \"\n                f\"type {type(component)}\"\n            )\n        return ConfiguredDataSink[component_type](  # type: ignore\n            component=component, name=self.value.name\n        )\n\n\ndef build_configurable_data_sink_enum() -> ConfigurableComponent:\n    \"\"\"\n    Build an enum of configurable data sinks.\n    But conditional on if the corresponding vector store is available.\n    \"\"\"\n    enum_members = []\n\n    try:\n        from llama_index.vector_stores.chroma import (\n            ChromaVectorStore,","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/ingestion/data_sinks.py#L25-L61","documentation":"Thrown by build_configured_data_sink() when the enum member it is called on expects a different vector store class than the component instance you supplied. Each ConfigurableComponent member holds a ComponentConfig with one concrete component_type; the isinstance check enforces that the member and the instance agree. It prevents constructing a ConfiguredDataSink whose generic type parameter would not match the stored component.","triggerScenarios":"Manually pairing an enum member with a mismatched store, e.g. ConfigurableComponent.CHROMA.build_configured_data_sink(qdrant_store), or calling from_component() on one store and build_configured_data_sink() with another. Also triggered when a hard-coded enum member no longer matches after the store class changes during an upgrade.","commonSituations":"Copy-pasted workflow code that pins a specific enum member while the actual vector store is swapped (e.g. moving Chroma -> Qdrant without updating the enum); tests that construct enum members from fixtures of a different store type.","solutions":["Do not hard-code the enum member: derive it with ConfigurableComponent.from_component(component), which always returns the matching member.","If hard-coding, verify the member matches your store class (isinstance) before calling build_configured_data_sink().","Check for stale enum references after upgrading or swapping vector-store integrations."],"exampleFix":"# before\nsink = ConfigurableComponent.CHROMA.build_configured_data_sink(my_qdrant_store)  # raises\n\n# after\nmember = ConfigurableComponent.from_component(my_qdrant_store)\nsink = member.build_configured_data_sink(my_qdrant_store)","handlingStrategy":"validation","validationCode":"member = ConfigurableComponent.from_component(store)\nassert isinstance(store, member.value.component_type), 'member/store mismatch'","typeGuard":null,"tryCatchPattern":"try:\n    sink = member.build_configured_data_sink(store)\nexcept ValueError:\n    member = ConfigurableComponent.from_component(store)  # re-derive correct member\n    sink = member.build_configured_data_sink(store)","preventionTips":["Always derive the enum member via from_component() instead of hard-coding","Regenerate persisted workflow configs after swapping vector stores","Add isinstance(store, member.value.component_type) asserts in tests"],"tags":["ingestion","vector-store","workflow","type-mismatch"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}