From 97657e54ebfd19ba3e40f2e6f1bb9b406d280e1b Mon Sep 17 00:00:00 2001 From: Yeuoly <45712896+Yeuoly@users.noreply.github.com> Date: Tue, 9 Apr 2024 12:20:34 +0800 Subject: [PATCH] Fix/code transform result (#3203) --- api/core/workflow/nodes/code/code_node.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/core/workflow/nodes/code/code_node.py b/api/core/workflow/nodes/code/code_node.py index 097dbb660c8cde..bc1b8d7ce1e7bf 100644 --- a/api/core/workflow/nodes/code/code_node.py +++ b/api/core/workflow/nodes/code/code_node.py @@ -234,6 +234,9 @@ def _transform_result(self, result: dict, output_schema: Optional[dict[str, Code parameters_validated = {} for output_name, output_config in output_schema.items(): dot = '.' if prefix else '' + if output_name not in result: + raise ValueError(f'Output {prefix}{dot}{output_name} is missing.') + if output_config.type == 'object': # check if output is object if not isinstance(result.get(output_name), dict):