High severity intermediate · Fix: 5-10 min

PipelineComponentNotConnectedError

haystack.errors.PipelineComponentNotConnectedError

What this error means
Haystack raises PipelineComponentNotConnectedError when a pipeline component is used without being properly connected to the pipeline graph.

Stack trace

traceback
haystack.errors.PipelineComponentNotConnectedError: Component 'retriever' is not connected to the pipeline. Please connect all components before running the pipeline.
QUICK FIX
Add and connect all pipeline components explicitly using pipeline.add_node() and pipeline.connect_nodes() before running the pipeline.

Why it happens

This error occurs because Haystack pipelines require all components to be explicitly connected to form a directed graph. If a component is instantiated but not linked to the pipeline's flow, the pipeline cannot execute and raises this error.

Detection

Before running the pipeline, verify that all components are connected by checking the pipeline's graph structure or catching PipelineComponentNotConnectedError and logging the missing connections.

Causes & fixes

1

A pipeline component was created but never added or connected to the pipeline graph.

✓ Fix

Ensure you add the component to the pipeline using pipeline.add_node() or pipeline.connect_nodes() methods before running.

2

Incorrect or missing node names in pipeline.connect_nodes() calls causing components to remain unlinked.

✓ Fix

Double-check node names and connection calls to confirm all components are properly linked in the pipeline graph.

3

Using pipeline.run() without building the pipeline graph first.

✓ Fix

Always build and connect the pipeline graph completely before calling pipeline.run().

Code: broken vs fixed

Broken - triggers the error
python
from haystack import Pipeline
retriever = SomeRetriever()
pipeline = Pipeline()
# Missing pipeline.add_node() or connect_nodes() calls
result = pipeline.run(query="example")  # This line raises PipelineComponentNotConnectedError
Fixed - works correctly
python
import os
from haystack import Pipeline
retriever = SomeRetriever()
pipeline = Pipeline()
pipeline.add_node(component=retriever, name="retriever", inputs=["Query"])
# Connected the retriever node properly
result = pipeline.run(query="example")  # Now runs without error
print(result)
# Added node to pipeline to fix connection error
Added pipeline.add_node() call to properly connect the retriever component to the pipeline graph, preventing the connection error.

Workaround

Catch PipelineComponentNotConnectedError and log the missing component names, then manually connect them or fallback to a simpler pipeline configuration.

Prevention

Always build and verify the pipeline graph connections programmatically before running, using pipeline.graph or pipeline.get_nodes() to confirm all components are linked.

Python 3.9+ · haystack >=1.0.0 · tested on 1.14.0
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.