{"record":{"id":"9b52825952917327","repo":"deepset-ai/haystack","slug":"no-input-data-provided-for-output-adaptation","errorCode":null,"errorMessage":"No input data provided for output adaptation","messagePattern":"No input data provided for output adaptation","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"haystack/components/converters/output_adapter.py","lineNumber":125,"sourceCode":"        component.set_input_types(self, **dict.fromkeys(input_types, Any))\n        component.set_output_types(self, output=output_type)\n        self.output_type = output_type\n\n    def run(self, **kwargs: Any) -> dict[str, Any]:\n        \"\"\"\n        Renders the Jinja template with the provided inputs.\n\n        :param kwargs:\n            Must contain all variables used in the `template` string.\n        :returns:\n            A dictionary with the following keys:\n            - `output`: Rendered Jinja template.\n\n        :raises OutputAdaptationException: If template rendering fails.\n        \"\"\"\n        # check if kwargs are empty\n        if not kwargs:\n            raise ValueError(\"No input data provided for output adaptation\")\n        for name, filter_func in self.custom_filters.items():\n            self._env.filters[name] = filter_func\n        adapted_outputs = {}\n        try:\n            adapted_output_template = self._env.from_string(self.template)\n            output_result = adapted_output_template.render(**kwargs)\n            if isinstance(output_result, jinja2.runtime.Undefined):\n                raise OutputAdaptationException(f\"Undefined variable in the template {self.template}; kwargs: {kwargs}\")  # noqa: TRY301\n\n            # We suppress the exception in case the output is already a string, otherwise\n            # we try to evaluate it and would fail.\n            # This must be done cause the output could be different literal structures.\n            # This doesn't support any user types.\n            with contextlib.suppress(Exception):\n                if not self._unsafe:\n                    output_result = ast.literal_eval(output_result)\n\n            adapted_outputs[\"output\"] = output_result","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/components/converters/output_adapter.py#L107-L143","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure run() receives at least one kwarg matching a template variable","Check the upstream component actually emits the expected output key","Guard the adapter invocation: only run it when inputs are present"],"exampleFix":"// before\nresult = adapter.run()  # no inputs\n// after\nresult = adapter.run(docs=docs) if docs else None","handlingStrategy":"validation","validationCode":"def safe_run(adapter, **kwargs):\n    if not kwargs:\n        raise ValueError(\"OutputAdapter requires at least one kwarg\")\n    return adapter.run(**kwargs)","typeGuard":null,"tryCatchPattern":"try:\n    out = adapter.run(**inputs)\nexcept ValueError as e:\n    if \"No input data\" in str(e):\n        out = None  # handle empty-input branch\n    else:\n        raise","preventionTips":["Check upstream component output keys before connecting to OutputAdapter","Guard conditional pipeline branches that may skip the adapter's input","Pass all template variables explicitly to run()"],"tags":["python","haystack","jinja","output-adapter","missing-input"],"backgroundTag":"missing-input-data","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}