deepset-ai/haystack · error · ValueError

Component named {sender_component_name} not found in the pip

Error message

Component named {sender_component_name} not found in the pipeline.

What it means

connect() reads the sender's output_sockets (and then the receiver's input_sockets) from the pipeline graph; if the component name is not a node in the graph, KeyError is converted to ValueError stating the component was not found. This fires before any socket-matching logic runs.

Source

Thrown at haystack/core/pipeline/base.py:626

        :returns:
            The Pipeline instance.

        :raises PipelineConnectError:
            If the two components cannot be connected (for example if one of the components is
            not present in the pipeline, or the connections don't match by type, and so on).
        """
        # Edges may be named explicitly by passing 'node_name.edge_name' to connect().
        sender_component_name, sender_socket_name = parse_connect_string(sender)
        receiver_component_name, receiver_socket_name = parse_connect_string(receiver)

        if sender_component_name == receiver_component_name:
            raise PipelineConnectError("Connecting a Component to itself is not supported.")

        # Get the nodes data.
        try:
            sender_sockets = self.graph.nodes[sender_component_name]["output_sockets"]
        except KeyError as exc:
            raise ValueError(f"Component named {sender_component_name} not found in the pipeline.") from exc
        try:
            receiver_sockets = self.graph.nodes[receiver_component_name]["input_sockets"]
        except KeyError as exc:
            raise ValueError(f"Component named {receiver_component_name} not found in the pipeline.") from exc

        if not sender_sockets:
            raise PipelineConnectError(
                f"'{sender_component_name}' does not have any output connections. "
                f"Please check that the output types of '{sender_component_name}.run' are set, "
                f"for example by using the '@component.output_types' decorator."
            )

        # If the name of either socket is given, get the socket
        sender_socket: OutputSocket | None = None
        if sender_socket_name:
            sender_socket = sender_sockets.get(sender_socket_name)
            if not sender_socket:
                raise PipelineConnectError(

View on GitHub (pinned to e318778c9b)

Solutions

  1. Add the component first with add_component() using the exact name used in connect()
  2. Fix the spelling/case of the sender (or receiver) name to match the registered name
  3. Validate names before connecting: check both in pipe.graph.nodes

Example fix

// before
pipe.add_component("retriever", r)
pipe.connect("retriver.documents", "llm.prompt")  # typo
// after
pipe.connect("retriever.documents", "llm.prompt")
Defensive patterns

Strategy: validation

Validate before calling

def is_connectable(pipe, sender: str, receiver: str) -> bool:
    s, r = sender.split(".")[0], receiver.split(".")[0]
    return s in pipe.graph.nodes and r in pipe.graph.nodes

Type guard

def component_in_pipeline(pipe, name: str) -> bool:
    return name in pipe.graph.nodes

Try / catch

try:
    pipe.connect(sender, receiver)
except ValueError as e:
    if "not found in the pipeline" in str(e):
        logger.error("Unknown component in connect: %s", e)
        raise
    raise

Prevention

When it happens

Trigger: pipe.connect("retriver.prompt", "llm.prompt") with a misspelled component name; connecting before the component was added; name case mismatch; connecting components that belong to a different pipeline instance.

Common situations: Typos in component names in long connect() chains; refactors renaming components; building connections in config-driven code where names come from external YAML.

Related errors


AI-assisted analysis of deepset-ai/haystack@e318778c9b (2026-08-30). Data as JSON: /api/errors/c8d83091fb343145. Report an issue: GitHub.