From 1fbba38436371f3d9f727fd7d82a2daa1d8a03ad Mon Sep 17 00:00:00 2001 From: Harry Date: Thu, 8 Jan 2026 11:14:23 +0800 Subject: [PATCH] fix(command-node): improve error reporting in command execution - Updated error handling to provide detailed stderr output when a command fails. - Streamlined working directory and command rendering by combining operations into single lines. --- api/core/workflow/nodes/command/node.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/api/core/workflow/nodes/command/node.py b/api/core/workflow/nodes/command/node.py index 0fe837e009..65064f7433 100644 --- a/api/core/workflow/nodes/command/node.py +++ b/api/core/workflow/nodes/command/node.py @@ -64,11 +64,8 @@ class CommandNode(Node[CommandNodeData]): error_type="SandboxNotInitializedError", ) - working_directory = (self.node_data.working_directory or "").strip() - raw_command = (self.node_data.command or "").strip() - - working_directory = self._render_template(working_directory).strip() - raw_command = self._render_template(raw_command).strip() + working_directory = self._render_template((self.node_data.working_directory or "").strip()) + raw_command = self._render_template(self.node_data.command or "") working_directory = working_directory or None @@ -118,7 +115,7 @@ class CommandNode(Node[CommandNodeData]): status=WorkflowNodeExecutionStatus.FAILED, outputs=outputs, process_data=process_data, - error=f"Command exited with code {result.exit_code}", + error=f"{result.stderr.decode('utf-8', errors='replace')}\n\nCommand exited with code {result.exit_code}", error_type=CommandExecutionError.__name__, )