From 0d33714f28ac01efb975185458de8e94293d39b9 Mon Sep 17 00:00:00 2001 From: Harry Date: Thu, 8 Jan 2026 11:14:37 +0800 Subject: [PATCH] fix(command-node): enhance error message formatting in command execution - Improved error message handling by assigning the stderr output to a variable for better readability. - Ensured consistent error reporting when a command fails, maintaining clarity in the output. --- api/core/workflow/nodes/command/node.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/core/workflow/nodes/command/node.py b/api/core/workflow/nodes/command/node.py index 65064f7433..cecd1549aa 100644 --- a/api/core/workflow/nodes/command/node.py +++ b/api/core/workflow/nodes/command/node.py @@ -111,11 +111,14 @@ class CommandNode(Node[CommandNodeData]): process_data = {"command": command, "working_directory": working_directory} if result.exit_code not in (None, 0): + error_message = ( + f"{result.stderr.decode('utf-8', errors='replace')}\n\nCommand exited with code {result.exit_code}" + ) return NodeRunResult( status=WorkflowNodeExecutionStatus.FAILED, outputs=outputs, process_data=process_data, - error=f"{result.stderr.decode('utf-8', errors='replace')}\n\nCommand exited with code {result.exit_code}", + error=error_message, error_type=CommandExecutionError.__name__, )