From a5aca5e3de77c9e5cf1945f556fe72138ebf8c13 Mon Sep 17 00:00:00 2001 From: "a.b.christie" Date: Tue, 13 Jan 2026 10:36:07 +0000 Subject: [PATCH] fix: Better workflow start error handling --- workflow/workflow_engine.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/workflow/workflow_engine.py b/workflow/workflow_engine.py index f4f6771..0de8b24 100644 --- a/workflow/workflow_engine.py +++ b/workflow/workflow_engine.py @@ -204,7 +204,9 @@ def _handle_workflow_start_message(self, r_wfid: str) -> None: The first step is relatively easy (?) - all the variables (for the first step's 'command') will (must) be defined - in the RunningWorkflow's variables.""" + in the RunningWorkflow's variables. + + The step is not launched if there's an error preparing the step.""" rwf_response, _ = self._wapi_adapter.get_running_workflow( running_workflow_id=r_wfid @@ -224,7 +226,15 @@ def _handle_workflow_start_message(self, r_wfid: str) -> None: sp_resp = self._prepare_step( wf=wf_response, step_definition=first_step, rwf=rwf_response ) - assert sp_resp.error_msg is None + if sp_resp.error_msg: + self._wapi_adapter.set_running_workflow_done( + running_workflow_id=r_wfid, + success=False, + error_num=sp_resp.error_num, + error_msg=sp_resp.error_msg, + ) + return + # Launch it. # If there's a launch problem the step (and running workflow) will have # and error, stopping it. There will be no Pod event as the launch has failed.