deepset-ai/haystack · error · PipelineConnectError
Connection must have both sender and receiver: ${sender_repr
Error message
Connection must have both sender and receiver: ${sender_repr} -> ${receiver_repr} What it means
Pipeline.connect() raises PipelineConnectError when only one side of the connection could be resolved — i.e. the sender or receiver portion resolves to 'input'/'output' but not both components with sockets. A valid connection needs both a resolved sender (component+socket) and a resolved receiver (component+socket).
Source
Thrown at haystack/core/pipeline/base.py:757
# Get the only possible match
sender_socket = name_matches[0][0]
receiver_socket = name_matches[0][1]
conversion_strategy = name_matches[0][2]
# Connection must be valid on both sender/receiver sides
if not sender_socket or not receiver_socket or not sender_component_name or not receiver_component_name:
if sender_component_name and sender_socket:
sender_repr = f"{sender_component_name}.{sender_socket.name} ({_type_name(sender_socket.type)})"
else:
sender_repr = "input needed"
if receiver_component_name and receiver_socket:
receiver_repr = f"({_type_name(receiver_socket.type)}) {receiver_component_name}.{receiver_socket.name}"
else:
receiver_repr = "output"
msg = f"Connection must have both sender and receiver: {sender_repr} -> {receiver_repr}"
raise PipelineConnectError(msg)
logger.debug(
"Connecting '{sender_component}.{sender_socket_name}' to '{receiver_component}.{receiver_socket_name}'",
sender_component=sender_component_name,
sender_socket_name=sender_socket.name,
receiver_component=receiver_component_name,
receiver_socket_name=receiver_socket.name,
)
if receiver_component_name in sender_socket.receivers and sender_component_name in receiver_socket.senders:
# This is already connected, nothing to do
return self
if receiver_socket.senders:
receiver_socket = self._make_socket_auto_variadic(
component_name=receiver_component_name, receiver_socket=receiver_socket, error_type=PipelineConnectError
)
View on GitHub (pinned to e318778c9b)
Solutions
- Provide full 'component.socket' names for BOTH sender and receiver so both sides resolve
- Remove any literal 'input'/'output' placeholders copied from 1.x pipelines
- Verify both component names and socket names exist on their components
Example fix
// before
pipeline.connect('retriever', 'output')
// after
pipeline.connect('retriever.documents', 'writer.documents') Defensive patterns
Strategy: validation
Validate before calling
parts_s, parts_r = sender_spec.split('.'), receiver_spec.split('.')
assert all(len(p) == 2 and p[0] not in ('input', 'output') for p in (parts_s, parts_r)), 'Provide full component.socket names for both sides' Type guard
def is_full_socket_spec(spec: str) -> bool:
comp, _, sock = spec.partition('.')
return bool(comp and sock) and comp not in ('input', 'output') Try / catch
try:
pipeline.connect(sender_spec, receiver_spec)
except PipelineConnectError as e:
if 'must have both sender and receiver' in str(e):
raise ValueError('Use full component.socket notation on both sides') from e Prevention
- Avoid 1.x 'input'/'output' endpoint conventions in 2.x pipelines
- Always use component.socket on both sides when partially specifying
- Migrate legacy pipeline definitions systematically
When it happens
Trigger: Using the legacy 'component.socket' shorthand with 'input'/'output' literals such as pipeline.connect('comp.input', 'output') or similar partial notations that resolve only one side, in a haystack version that still accepts the input/output keyword forms but finds the other side missing.
Common situations: Mixing old deepset-ai/haystack 1.x pipeline.connect('a', 'b.c') conventions with 2.x semantics; passing 'input'/'output' placeholder strings copied from old code or docs; partially commenting out one side of a connection.
Related errors
- Cannot connect '${sender_component_name}' with '${receiver_c
- 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/e24f37ec7aa3e2d6.
Report an issue: GitHub.