{"record":{"id":"0cba8bd2767e0ceb","repo":"deepset-ai/haystack","slug":"cannot-connect-sender-component-name-with","errorCode":null,"errorMessage":"Cannot connect '${sender_component_name}' with '${receiver_component_name}': their declared input and output types do not match.\\n${status} | Cannot connect '${sender_component_name}' with '${receiver_component_name}': no matching connections available.\\n${status}","messagePattern":"Cannot connect '(.+?)' with '(.+?)': their declared input and output types do not match\\.\\\\n(.+?) \\| Cannot connect '(.+?)' with '(.+?)': no matching connections available\\.\\\\n(.+?)","errorType":"exception","errorClass":"PipelineConnectError","httpStatus":null,"severity":"error","filePath":"haystack/core/pipeline/base.py","lineNumber":714,"sourceCode":"            sender_sockets=sender_socket_candidates,\n            receiver_node=receiver_component_name,\n            receiver_sockets=receiver_socket_candidates,\n        )\n\n        if not possible_connections:\n            # There's no possible connection between these two components\n            if len(sender_socket_candidates) == len(receiver_socket_candidates) == 1:\n                msg = (\n                    f\"Cannot connect '{sender_component_name}.{sender_socket_candidates[0].name}' with \"\n                    f\"'{receiver_component_name}.{receiver_socket_candidates[0].name}': \"\n                    f\"their declared input and output types do not match.\\n{status}\"\n                )\n            else:\n                msg = (\n                    f\"Cannot connect '{sender_component_name}' with '{receiver_component_name}': \"\n                    f\"no matching connections available.\\n{status}\"\n                )\n            raise PipelineConnectError(msg)\n\n        if len(possible_connections) == 1:\n            # There's only one possible connection, use it\n            sender_socket = possible_connections[0][0]\n            receiver_socket = possible_connections[0][1]\n            conversion_strategy = possible_connections[0][2]\n\n        if len(possible_connections) > 1:\n            # There are multiple possible connection, let's try to match them by name\n            name_matches = [\n                (out_sock, in_sock, conversion_strategy_)\n                for out_sock, in_sock, conversion_strategy_ in possible_connections\n                if in_sock.name == out_sock.name\n            ]\n            if len(name_matches) != 1:\n                # There's are either no matches or more than one, we can't pick one reliably\n                msg = (\n                    f\"Cannot connect '{sender_component_name}' with \"","sourceCodeStart":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/core/pipeline/base.py#L696-L732","documentation":"Pipeline.connect() raises PipelineConnectError when no connection between sender and receiver matches by type. Either the declared types are incompatible ('their declared input and output types do not match') or no possible connections remain after filtering ('no matching connections available'); `status` describes which sockets are free/occupied.","triggerScenarios":"Connecting components whose output type is not compatible with the receiver's input type (no subtyping and no lazy variadic match), or all candidate receiver inputs are already occupied by other connections.","commonSituations":"Swapping component order (e.g. retriever output fed into an embedder expecting text); connecting a component to itself in the wrong direction; all compatible inputs already taken by earlier connect() calls; using a custom component with mismatched declared types.","solutions":["Check the declared types of the sockets (shown in the error status) and reorder or insert an adapter component between them","Choose a different receiver input socket that matches the sender's output type","Use a conversion bridge (e.g. OutputAdapter) to convert types","If inputs are occupied, disconnect the conflicting connection or pick another free input"],"exampleFix":"// before\npipeline.connect('retriever', 'text_embedder')  # documents -> text mismatch\n// after\nfrom haystack.components.converters import OutputAdapter\npipeline.add_component('adapter', OutputAdapter(template='{{ documents[0].content }}', output_type=str))\npipeline.connect('retriever', 'adapter')\npipeline.connect('adapter', 'text_embedder')","handlingStrategy":"validation","validationCode":"from haystack.core.type_utils import _type_name\ncomp_s = pipeline.get_component(sender)\ncomp_r = pipeline.get_component(receiver)\nout_types = [s.type for s in comp_s.__haystack_output__._sockets_dict.values()]\nin_types = [s.type for s in comp_r.__haystack_input__._sockets_dict.values()]\nprint(f'{sender} outputs: {out_types} -> {receiver} inputs: {in_types}')  # verify compatibility manually before connect","typeGuard":"def types_compatible(out_type, in_type) -> bool:\n    return out_type == in_type or (isinstance(out_type, type) and isinstance(in_type, type) and issubclass(out_type, in_type))","tryCatchPattern":"try:\n    pipeline.connect(sender, receiver)\nexcept PipelineConnectError as e:\n    if 'do not match' in str(e) or 'no matching connections' in str(e):\n        raise TypeError(f'Incompatible sockets {sender}->{receiver}; insert an OutputAdapter') from e","preventionTips":["Check declared input/output types of components before wiring","Insert OutputAdapter when types differ","Keep pipeline topologies simple and test connectivity in unit tests"],"tags":["pipeline","haystack","type-mismatch","connection"],"backgroundTag":"pipeline-type-mismatch","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}