deepset-ai/haystack · error

No input data provided for output adaptation

Error message

No input data provided for output adaptation

What it means

OutputAdapter.run renders the template using its keyword arguments as the template context. If run() is invoked with no kwargs at all, there is no data to adapt, so it raises ValueError instead of rendering an empty context.

Source

Thrown at haystack/components/converters/output_adapter.py:125

        component.set_input_types(self, **dict.fromkeys(input_types, Any))
        component.set_output_types(self, output=output_type)
        self.output_type = output_type

    def run(self, **kwargs: Any) -> dict[str, Any]:
        """
        Renders the Jinja template with the provided inputs.

        :param kwargs:
            Must contain all variables used in the `template` string.
        :returns:
            A dictionary with the following keys:
            - `output`: Rendered Jinja template.

        :raises OutputAdaptationException: If template rendering fails.
        """
        # check if kwargs are empty
        if not kwargs:
            raise ValueError("No input data provided for output adaptation")
        for name, filter_func in self.custom_filters.items():
            self._env.filters[name] = filter_func
        adapted_outputs = {}
        try:
            adapted_output_template = self._env.from_string(self.template)
            output_result = adapted_output_template.render(**kwargs)
            if isinstance(output_result, jinja2.runtime.Undefined):
                raise OutputAdaptationException(f"Undefined variable in the template {self.template}; kwargs: {kwargs}")  # noqa: TRY301

            # We suppress the exception in case the output is already a string, otherwise
            # we try to evaluate it and would fail.
            # This must be done cause the output could be different literal structures.
            # This doesn't support any user types.
            with contextlib.suppress(Exception):
                if not self._unsafe:
                    output_result = ast.literal_eval(output_result)

            adapted_outputs["output"] = output_result

View on GitHub (pinned to e318778c9b)

Solutions

  1. Ensure run() receives at least one kwarg matching a template variable
  2. Check the upstream component actually emits the expected output key
  3. Guard the adapter invocation: only run it when inputs are present

Example fix

// before
result = adapter.run()  # no inputs
// after
result = adapter.run(docs=docs) if docs else None
Defensive patterns

Strategy: validation

Validate before calling

def safe_run(adapter, **kwargs):
    if not kwargs:
        raise ValueError("OutputAdapter requires at least one kwarg")
    return adapter.run(**kwargs)

Try / catch

try:
    out = adapter.run(**inputs)
except ValueError as e:
    if "No input data" in str(e):
        out = None  # handle empty-input branch
    else:
        raise

Prevention

When it happens

Trigger: Calling output_adapter.run() with zero keyword arguments, typically when the upstream component in the pipeline produced no outputs or the connection wiring passes nothing.

Common situations: A pipeline branch where the preceding component returned an empty dict; invoking run() directly in tests without arguments; conditional pipelines where the adapter's input is skipped.

Related errors


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