diff --git a/workflow/controller/operator.go b/workflow/controller/operator.go index 7850a741ce1a..aee71bcb3672 100644 --- a/workflow/controller/operator.go +++ b/workflow/controller/operator.go @@ -1547,7 +1547,7 @@ func buildRetryStrategyLocalScope(node *wfv1.NodeStatus, nodes wfv1.Nodes) map[s lastChildNode := getChildNodeIndex(node, nodes, -1) exitCode := "-1" - if lastChildNode.Outputs != nil { + if lastChildNode.Outputs != nil && lastChildNode.Outputs.ExitCode != nil { exitCode = *lastChildNode.Outputs.ExitCode } localScope[common.LocalVarRetriesLastExitCode] = exitCode