deepset-ai/haystack · error · ValueError

Input '${input_name}' not found in component '${component_na

Error message

Input '${input_name}' not found in component '${component_name}'.

What it means

Pipeline.validate_input() raises this ValueError when a component is given an input key that does not match any of its declared input sockets (checked via instance.__haystack_input__._sockets_dict). The pipeline rejects unknown kwargs before running any component, because inputs are matched to typed sockets and there is nowhere to route a name the component never declared.

Source

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

        * Each Component is not missing any input
        * Each Component has only one input per input socket, if not variadic
        * Each Component doesn't receive inputs that are already sent by another Component

        :param data:
            A dictionary of inputs for the pipeline's components. Each key is a component name.

        :raises ValueError:
            If inputs are invalid according to the above.
        """
        for component_name, component_inputs in data.items():
            # Check that the component exists
            if component_name not in self.graph.nodes:
                raise ValueError(f"Component named '{component_name}' not found in the pipeline.")
            # Check that no input is provided that the component can't accept
            instance = self.graph.nodes[component_name]["instance"]
            for input_name in component_inputs.keys():
                if input_name not in instance.__haystack_input__._sockets_dict:
                    raise ValueError(f"Input '{input_name}' not found in component '{component_name}'.")

        for component_name in self.graph.nodes:
            instance = self.graph.nodes[component_name]["instance"]
            for socket_name, socket in instance.__haystack_input__._sockets_dict.items():
                component_inputs = data.get(component_name, {})
                # Check that no mandatory input is missing for any component in the pipeline
                if socket.senders == [] and socket.is_mandatory and socket_name not in component_inputs:
                    raise ValueError(f"Missing mandatory input '{socket_name}' for component '{component_name}'.")

                # Check if an input is provided more than once for non-variadic sockets
                if socket.senders and socket_name in component_inputs:
                    self._make_socket_auto_variadic(
                        component_name=component_name, receiver_socket=socket, error_type=ValueError
                    )

    def _make_socket_auto_variadic(
        self, component_name: str, receiver_socket: InputSocket, error_type: type[Exception]
    ) -> InputSocket:

View on GitHub (pinned to e318778c9b)

Solutions

  1. Inspect the component's declared inputs: print the component's __haystack_input__ sockets or check its run() signature, and correct the input key in the dict passed to pipeline.run().
  2. If the component API changed after a haystack upgrade, update the call site to the new input names (check the component's release notes/migration guide).
  3. If the key is genuinely needed, add it to the component by declaring a new @component.input socket in the component definition.

Example fix

// before
pipeline.run({"retriever": {"query_text": "hello"}})
# after (Retriever's socket is named 'query')
pipeline.run({"retriever": {"query": "hello"}})
Defensive patterns

Strategy: validation

Validate before calling

comp = pipeline.get_component("retriever")
inputs = comp.__haystack_input__._sockets_dict.keys()
bad = set(my_inputs) - set(inputs)
assert not bad, f"Unknown inputs for retriever: {bad}"

Type guard

def has_valid_inputs(name: str, inputs: dict) -> bool:
    comp = pipeline.get_component(name)
    return set(inputs) <= set(comp.__haystack_input__._sockets_dict)

Try / catch

try:
    result = pipeline.run(data)
except ValueError as e:
    logger.error("Invalid pipeline inputs: %s", e)

Prevention

When it happens

Trigger: Calling pipeline.run({"component": {"wrong_kwarg": value}}) or connect/execute paths where the component_inputs dict passed to validate_input contains a key not in the component's input sockets; also happens after renaming a component input without updating the caller's input dict.

Common situations: Typo in an input name (e.g. 'query' vs 'question'); passing extra inputs to a component whose API changed between haystack versions; feeding kwargs of one component (e.g. OpenAIChatGenerator) to another (e.g. HuggingFaceLocalGenerator); programmatic construction of input dicts with stale keys.

Related errors


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