diff --git a/haystack/nodes/other/join.py b/haystack/nodes/other/join.py index 04b3f7b470..d2809648ef 100644 --- a/haystack/nodes/other/join.py +++ b/haystack/nodes/other/join.py @@ -22,7 +22,8 @@ def run( # type: ignore ) -> Tuple[Dict, str]: if inputs: results = self.run_accumulated(inputs, top_k_join=top_k_join) - results[0]["root_node"] = inputs[0]["root_node"] + if "root_node" in inputs[0]: + results[0]["root_node"] = inputs[0]["root_node"] return results warnings.warn("You are using a JoinNode with only one input. This is usually equivalent to a no-op.") return self.run_accumulated( @@ -58,7 +59,8 @@ def run_batch( # type: ignore ) -> Tuple[Dict, str]: if inputs: results = self.run_batch_accumulated(inputs=inputs, top_k_join=top_k_join) - results[0]["root_node"] = inputs[0]["root_node"] + if "root_node" in inputs[0]: + results[0]["root_node"] = inputs[0]["root_node"] return results warnings.warn("You are using a JoinNode with only one input. This is usually equivalent to a no-op.") return self.run_batch_accumulated(