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_source() when the enum member's registered component_type does not match the component instance passed in. The isinstance guard ensures the produced ConfiguredDataSource is generic over the right component config type. It is the data-source counterpart of the data-sink compatibility check.
Source
Thrown at llama-index-core/llama_index/core/ingestion/data_sources.py:67
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 data source component."
)
def build_configured_data_source(
self, component: BaseComponent, name: Optional[str] = None
) -> "ConfiguredDataSource":
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)}"
)
elif isinstance(component, BasePydanticReader):
reader_config = ReaderConfig(reader=component)
return ConfiguredDataSource[ReaderConfig](component=reader_config) # type: ignore
if isinstance(component, DocumentGroup) and name is None:
# if the component is a DocumentGroup, we want to use the
# full file path as the name of the data source
component = cast(DocumentGroup, component)
name = component.file_path
if name is None:
suffix = uuid.uuid1()
name = self.value.name + f" [{suffix}]"
return ConfiguredDataSource[component_type]( # type: ignore
component=component, name=nameView on GitHub (pinned to afd0fef371)
Solutions
- Derive the member with ConfigurableComponent.from_component(component) instead of hard-coding it.
- Guard with isinstance(component, member.value.component_type) before calling build_configured_data_source().
- Re-generate persisted workflow configs after changing readers.
Example fix
# before source = ConfigurableComponent.SIMPLE_DIRECTORY.build_configured_data_source(db_reader) # raises # after member = ConfigurableComponent.from_component(db_reader) source = member.build_configured_data_source(db_reader)
Defensive patterns
Strategy: validation
Validate before calling
if not isinstance(component, member.value.component_type):
member = ConfigurableComponent.from_component(component) Try / catch
try:
source = member.build_configured_data_source(component)
except ValueError:
member = ConfigurableComponent.from_component(component)
source = member.build_configured_data_source(component) Prevention
- Derive members with from_component() at call time
- Treat saved enum references as cache that must be invalidated on reader swaps
When it happens
Trigger: Calling a specific enum member's build_configured_data_source() with a reader of a different type, e.g. member for SimpleDirectoryReader given a DatabaseReader; mixing a member obtained from one reader with an instance of another in cached/hard-coded workflow code.
Common situations: Hard-coded enum members in saved workflow configurations that break when the reader is swapped; test fixtures reusing members across different readers.
Related errors
- The enum value {self} is not compatible with component of ty
- Component {component} is not a supported data source compone
- The enum value {self} is not compatible with component of ty
- Component {component} is not a supported data sink component
- Component {component} is not a supported transformation comp
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/071a4bc1f329b89b.
Report an issue: GitHub.