deepset-ai/haystack · error

LLM evaluator expected input parameter '{param}' but receive

Error message

LLM evaluator expected input parameter '{param}' but received only {received.keys()}.

What it means

The LLM evaluator validates that every input parameter declared on its input socket is present in the dictionary received at run time. If an expected key is missing, it raises ValueError naming the missing parameter and listing the keys actually received.

Source

Thrown at haystack/components/evaluators/llm_evaluator.py:449

    @staticmethod
    def validate_input_parameters(expected: dict[str, Any], received: dict[str, Any]) -> None:
        """
        Validate the input parameters.

        :param expected:
            The expected input parameters.
        :param received:
            The received input parameters.

        :raises ValueError:
            If not all expected inputs are present in the received inputs
            If the received inputs are not lists or have different lengths
        """
        # Validate that all expected inputs are present in the received inputs
        for param in expected:
            if param not in received:
                msg = f"LLM evaluator expected input parameter '{param}' but received only {received.keys()}."
                raise ValueError(msg)

        # Validate that all received inputs are lists
        if not all(isinstance(_input, list) for _input in received.values()):
            msg = (
                "LLM evaluator expects all input values to be lists but received "
                f"{[type(_input) for _input in received.values()]}."
            )
            raise ValueError(msg)

        # Validate that all received inputs are of the same length
        inputs = received.values()
        length = len(next(iter(inputs)))
        if not all(len(_input) == length for _input in inputs):
            msg = (
                f"LLM evaluator expects all input lists to have the same length but received {inputs} with lengths "
                f"{[len(_input) for _input in inputs]}."
            )
            raise ValueError(msg)

View on GitHub (pinned to e318778c9b)

Solutions

  1. Pass all declared input parameters as lists in the run() inputs dict, e.g. run({"questions": [...], "responses": [...]})
  2. Check the component's inputs via print(llm_evaluator) or its __inputs__ to see expected parameter names
  3. Ensure upstream component output socket names match what you feed into the evaluator when connecting pipelines

Example fix

// before
result = evaluator.run({"questions": questions})
// after
result = evaluator.run({"questions": questions, "responses": responses})
Defensive patterns

Strategy: validation

Validate before calling

expected = {"questions", "responses"}
missing = expected - set(inputs)
if missing:
    raise ValueError(f"Missing evaluator inputs: {missing}")

Type guard

def has_all_inputs(inputs: dict, expected: set[str]) -> bool:
    return expected.issubset(inputs.keys())

Try / catch

try:
    result = evaluator.run(inputs)
except ValueError as e:
    logger.error("LLM evaluator input validation failed: %s", e)
    raise

Prevention

When it happens

Trigger: Calling llm_evaluator.run() (directly or via Pipeline.run) with a inputs dict that omits one of the declared inputs, e.g. run({"questions": [...]}) when the evaluator expects both "questions" and "responses". Triggered from validate_input_parameters, invoked by both run and run_async.

Common situations: Wiring a pipeline where an upstream component was renamed or its output name changed; forgetting to pass a second input added in a newer haystack version; calling the evaluator outside a pipeline with hand-built dicts.

Related errors


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