deepset-ai/haystack · error · ValueError
Pipeline must be provided to SuperComponent.
Error message
Pipeline must be provided to SuperComponent.
What it means
SuperComponent wraps an existing Pipeline, so a pipeline is mandatory. Constructing SuperComponent without the pipeline argument raises ValueError.
Source
Thrown at haystack/core/super_component/super_component.py:67
```python
input_mapping={
"query": ["retriever.query", "prompt_builder.query"],
}
```
:param output_mapping: A dictionary mapping pipeline output socket paths to component output names.
If not provided, a default output mapping will be created based on all pipeline outputs.
Example:
```python
output_mapping={
"retriever.documents": "documents",
"generator.replies": "replies",
}
```
:raises InvalidMappingError: Raised if any mapping is invalid or type conflicts occur
:raises ValueError: Raised if no pipeline is provided
"""
if pipeline is None:
raise ValueError("Pipeline must be provided to SuperComponent.")
self.pipeline: Pipeline = pipeline
# Determine input types based on pipeline and mapping
pipeline_inputs = self.pipeline.inputs()
resolved_input_mapping = (
input_mapping if input_mapping is not None else self._create_input_mapping(pipeline_inputs)
)
self._validate_input_mapping(pipeline_inputs, resolved_input_mapping)
input_types = self._resolve_input_types_from_mapping(pipeline_inputs, resolved_input_mapping)
# Set input types on the component
for input_name, info in input_types.items():
component.set_input_type(self, name=input_name, **info)
self.input_mapping: dict[str, list[str]] = resolved_input_mapping
self._original_input_mapping = input_mapping
# Set output types based on pipeline and mappingView on GitHub (pinned to e318778c9b)
Solutions
- Build a Pipeline and pass it: SuperComponent(pipeline=pipe)
- Check that the variable holding the pipeline is not None before constructing
Example fix
// before
super_comp = SuperComponent()
// after
pipe = Pipeline()
pipe.add_component("embedder", SentenceTransformersTextEmbedder())
super_comp = SuperComponent(pipeline=pipe) Defensive patterns
Strategy: validation
Validate before calling
def build_super_component(pipeline):
if pipeline is None:
raise ValueError("pipeline must be a Pipeline instance before creating SuperComponent")
return SuperComponent(pipeline=pipeline) Type guard
from haystack import Pipeline
def is_pipeline(p: object) -> bool:
return isinstance(p, Pipeline) Try / catch
try:
super_comp = SuperComponent(pipeline=pipe)
except ValueError as e:
if "Pipeline must be provided" in str(e):
pipe = Pipeline()
super_comp = SuperComponent(pipeline=pipe)
else:
raise Prevention
- Always construct the Pipeline before the SuperComponent
- Avoid optional pipeline variables that can be None at call time
- Initialize pipelines in dedicated factory functions that guarantee a return value
When it happens
Trigger: SuperComponent() or SuperComponent(pipeline=None) called without a valid Pipeline instance.
Common situations: Refactoring code where the pipeline is built conditionally and ends up None; forgetting to pass pipeline when copying constructor examples; a factory function returning None.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- {type(self.chat_generator).__name__} does not accept tools p
- MarkdownHeaderSplitter only works with text documents but co
- Missing 'type' in component '{name}'
- Successfully imported module '{module}' but couldn't find '{
- Component '{component_type}' (name: '{name}') not imported.
AI-assisted analysis of deepset-ai/haystack@e318778c9b (2026-08-30).
Data as JSON: /api/errors/117f6a6a0fb34f6b.
Report an issue: GitHub.