run-llama/llama_index · error · ValueError

The enum value {self} is not compatible with component of ty

Error message

The enum value {self} is not compatible with component of type {type(component)}

What it means

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.

Source

Thrown at llama-index-core/llama_index/core/ingestion/data_sinks.py:43

class ConfigurableComponent(Enum):
    @classmethod
    def from_component(
        cls, component: BasePydanticVectorStore
    ) -> "ConfigurableComponent":
        component_class = type(component)
        for component_type in cls:
            if component_type.value.component_type == component_class:
                return component_type
        raise ValueError(
            f"Component {component} is not a supported data sink component."
        )

    def build_configured_data_sink(
        self, component: BasePydanticVectorStore
    ) -> "ConfiguredDataSink":
        component_type = self.value.component_type
        if not isinstance(component, component_type):
            raise ValueError(
                f"The enum value {self} is not compatible with component of "
                f"type {type(component)}"
            )
        return ConfiguredDataSink[component_type](  # type: ignore
            component=component, name=self.value.name
        )


def build_configurable_data_sink_enum() -> ConfigurableComponent:
    """
    Build an enum of configurable data sinks.
    But conditional on if the corresponding vector store is available.
    """
    enum_members = []

    try:
        from llama_index.vector_stores.chroma import (
            ChromaVectorStore,

View on GitHub (pinned to afd0fef371)

Solutions

  1. Do not hard-code the enum member: derive it with ConfigurableComponent.from_component(component), which always returns the matching member.
  2. If hard-coding, verify the member matches your store class (isinstance) before calling build_configured_data_sink().
  3. Check for stale enum references after upgrading or swapping vector-store integrations.

Example fix

# before
sink = ConfigurableComponent.CHROMA.build_configured_data_sink(my_qdrant_store)  # raises

# after
member = ConfigurableComponent.from_component(my_qdrant_store)
sink = member.build_configured_data_sink(my_qdrant_store)
Defensive patterns

Strategy: validation

Validate before calling

member = ConfigurableComponent.from_component(store)
assert isinstance(store, member.value.component_type), 'member/store mismatch'

Try / catch

try:
    sink = member.build_configured_data_sink(store)
except ValueError:
    member = ConfigurableComponent.from_component(store)  # re-derive correct member
    sink = member.build_configured_data_sink(store)

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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