deepset-ai/haystack · error · ValueError
There is no component named '{name}' in the pipeline. The va
Error message
There is no component named '{name}' in the pipeline. The valid component names are: What it means
remove_component(name) first looks the component up via get_component; if no node with that name exists, the underlying ValueError is re-raised with a message listing the valid component names so the caller can correct the name.
Source
Thrown at haystack/core/pipeline/base.py:546
Remove and returns component from the pipeline.
Remove an existing component from the pipeline by providing its name.
All edges that connect to the component will also be deleted.
:param name:
The name of the component to remove.
:returns:
The removed Component instance.
:raises ValueError:
If there is no component with that name already in the Pipeline.
"""
# Check that a component with that name is in the Pipeline
try:
instance = self.get_component(name)
except ValueError as exc:
raise ValueError(
f"There is no component named '{name}' in the pipeline. The valid component names are: ",
", ".join(n for n in self.graph.nodes),
) from exc
# Remove this component's name from its neighbors' sockets before the edges are gone,
# otherwise the surviving components are left holding dangling references to it.
for _, _, edge_data in self.graph.in_edges(name, data=True):
sender_socket = edge_data["from_socket"]
sender_socket.receivers = [r for r in sender_socket.receivers if r != name]
for _, _, edge_data in self.graph.out_edges(name, data=True):
receiver_socket = edge_data["to_socket"]
receiver_socket.senders = [s for s in receiver_socket.senders if s != name]
if (
len(receiver_socket.senders) <= 1
and receiver_socket.is_lazy_variadic
and not receiver_socket.wrap_input_in_list
):
receiver_socket.is_lazy_variadic = FalseView on GitHub (pinned to e318778c9b)
Solutions
- Check pipe.graph.nodes (or walk the pipeline) for the exact registered name and use it
- Read the valid names listed in the error message and fix the typo/case
- Guard with `if name in pipe.graph.nodes: pipe.remove_component(name)` before calling
Example fix
// before
pipe.remove_component("Retriever") # wrong case
// after
if "retriever" in pipe.graph.nodes:
pipe.remove_component("retriever") Defensive patterns
Strategy: validation
Validate before calling
def safe_remove(pipe, name: str) -> None:
if name in pipe.graph.nodes:
pipe.remove_component(name) Type guard
def component_exists(pipe, name: str) -> bool:
return name in pipe.graph.nodes Try / catch
try:
pipe.remove_component(name)
except ValueError as e:
if "no component named" in str(e):
logger.warning("Skipping removal, %s not in pipeline", name)
else:
raise Prevention
- Keep component names in constants shared by add/remove/connect code
- Parse the valid names listed in the error message when debugging
- Guard removals with `name in pipe.graph.nodes`
When it happens
Trigger: pipe.remove_component("retriever") when the component was registered under a different name; a typo or case mismatch ('Retriever' vs 'retriever'); removing a component that was already removed.
Common situations: Refactors renaming components without updating removal/teardown code; dynamic pipelines where names are generated; notebooks where the pipeline was rebuilt with different names.
Related errors
- Component instance cannot be added to the pipeline more than
- '{type(instance)}' doesn't seem to be a component. Is this c
- Component has already been added to this Pipeline under the
- Connecting a Component to itself is not supported.
- Component named {sender_component_name} not found in the pip
AI-assisted analysis of deepset-ai/haystack@e318778c9b (2026-08-30).
Data as JSON: /api/errors/81cca81592a3ba74.
Report an issue: GitHub.