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

Raised by build_configured_transformation() when the enum member's registered component_type does not match the transformation instance passed. The isinstance check keeps the ConfiguredTransformation generic type consistent with the wrapped component; a mismatched member/instance pair is rejected.

Source

Thrown at llama-index-core/llama_index/core/ingestion/transformations.py:109


class ConfigurableComponent(Enum):
    @classmethod
    def from_component(cls, component: BaseComponent) -> "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 transformation component."
        )

    def build_configured_transformation(
        self, component: BaseComponent
    ) -> "ConfiguredTransformation":
        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 ConfiguredTransformation[component_type](  # type: ignore
            component=component, name=self.value.name
        )


def build_configurable_transformation_enum() -> ConfigurableComponent:
    """
    Build an enum of configurable transformations.
    But conditional on if the corresponding component is available.
    """
    enum_members = []

    # Node parsers
    enum_members.append(
        (

View on GitHub (pinned to afd0fef371)

Solutions

  1. Resolve the member dynamically with ConfigurableComponent.from_component(component).
  2. Add an isinstance guard against member.value.component_type before building.
  3. Regenerate saved workflow configs whenever transformations change.

Example fix

# before
t = ConfigurableComponent.SENTENCE_SPLITTER.build_configured_transformation(my_custom_splitter)  # raises

# after
member = ConfigurableComponent.from_component(my_custom_splitter)
t = member.build_configured_transformation(my_custom_splitter)
Defensive patterns

Strategy: validation

Validate before calling

assert isinstance(component, member.value.component_type), (
    f'{member} expects {member.value.component_type}'
)

Try / catch

try:
    t = member.build_configured_transformation(component)
except ValueError:
    member = ConfigurableComponent.from_component(component)
    t = member.build_configured_transformation(component)

Prevention

When it happens

Trigger: Calling a fixed enum member's build_configured_transformation() with a different transformation class, e.g. a sentence-splitter member given a custom node parser; stale members persisted in saved workflow definitions after swapping transformations.

Common situations: Serialized workflow configurations that pin enum members; refactors that change the transformation but not the member lookup.

Related errors


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