{"record":{"id":"164b006869a5dc2e","repo":"deepset-ai/haystack","slug":"missing-mandatory-input-socket-name-for-compo","errorCode":null,"errorMessage":"Missing mandatory input '${socket_name}' for component '${component_name}'.","messagePattern":"Missing mandatory input '(.+?)' for component '(.+?)'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"haystack/core/pipeline/base.py","lineNumber":1158,"sourceCode":"            If inputs are invalid according to the above.\n        \"\"\"\n        for component_name, component_inputs in data.items():\n            # Check that the component exists\n            if component_name not in self.graph.nodes:\n                raise ValueError(f\"Component named '{component_name}' not found in the pipeline.\")\n            # Check that no input is provided that the component can't accept\n            instance = self.graph.nodes[component_name][\"instance\"]\n            for input_name in component_inputs.keys():\n                if input_name not in instance.__haystack_input__._sockets_dict:\n                    raise ValueError(f\"Input '{input_name}' not found in component '{component_name}'.\")\n\n        for component_name in self.graph.nodes:\n            instance = self.graph.nodes[component_name][\"instance\"]\n            for socket_name, socket in instance.__haystack_input__._sockets_dict.items():\n                component_inputs = data.get(component_name, {})\n                # Check that no mandatory input is missing for any component in the pipeline\n                if socket.senders == [] and socket.is_mandatory and socket_name not in component_inputs:\n                    raise ValueError(f\"Missing mandatory input '{socket_name}' for component '{component_name}'.\")\n\n                # Check if an input is provided more than once for non-variadic sockets\n                if socket.senders and socket_name in component_inputs:\n                    self._make_socket_auto_variadic(\n                        component_name=component_name, receiver_socket=socket, error_type=ValueError\n                    )\n\n    def _make_socket_auto_variadic(\n        self, component_name: str, receiver_socket: InputSocket, error_type: type[Exception]\n    ) -> InputSocket:\n        \"\"\"\n        Attempts to make the receiver socket lazy variadic in-place to accommodate a new sender.\n\n        A socket is automatically made lazy variadic when:\n          - It already has at least one connected sender\n          - It is not already variadic\n          - Its type is list, Optional[list], a union of list types\n","sourceCodeStart":1140,"sourceCodeEnd":1176,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/core/pipeline/base.py#L1140-L1176","documentation":"validate_input() raises this ValueError when a component in the pipeline has a mandatory input socket (is_mandatory) with no sender connected and the caller did not supply it in the run() input dict. The pipeline checks every component before executing so failures surface up front rather than mid-run.","triggerScenarios":"Calling pipeline.run() with an empty or partial dict while the pipeline contains a component whose mandatory socket has zero senders; e.g. a retriever with no connected query input and run({}) or run({\"other_component\": {...}}).","commonSituations":"Forgetting to pass the prompt/question to the first component of a linear pipeline; building a pipeline where one component was disconnected during refactoring; pipelines assembled conditionally where a required input path was left unconnected.","solutions":["Add the missing key to the run() input dict: pipeline.run({\"<component>\": {\"<socket_name>\": value}}).","Connect a sender to the socket with pipeline.connect(src_component.src_socket, \"<component>\", \"<socket_name>\") so it is no longer unconnected.","If the value is legitimately optional in your use, set a default in the component definition (InputSocket default) or declare it is_mandatory=False."],"exampleFix":"// before\nresult = pipeline.run({})\n# after\nresult = pipeline.run({\"retriever\": {\"query\": \"What is Haystack?\"}})","handlingStrategy":"validation","validationCode":"for name, comp in pipeline.components.items():\n    for sock_name, sock in comp.__haystack_input__._sockets_dict.items():\n        if sock.senders == [] and sock.is_mandatory and sock_name not in data.get(name, {}):\n            raise ValueError(f\"Must supply {name}.{sock_name}\")","typeGuard":"def has_all_mandatory(name: str, data: dict) -> bool:\n    comp = pipeline.get_component(name)\n    return all(s in data.get(name, {}) for s, sock in comp.__haystack_input__._sockets_dict.items()\n               if sock.senders == [] and sock.is_mandatory)","tryCatchPattern":"try:\n    result = pipeline.run(data)\nexcept ValueError as e:\n    logger.error(\"Missing mandatory input: %s\", e)","preventionTips":["List all unconnected mandatory sockets before calling run()","Always supply inputs for entry-point components of the pipeline","Use pipeline.connect() instead of relying on run-time inputs where possible"],"tags":["haystack","pipeline","validation","missing-input"],"backgroundTag":"missing-required-input","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}