{"record":{"id":"b20a3c2b292820aa","repo":"argoproj/argo-workflows","slug":"400-b20a3c","errorCode":"400","errorMessage":"workflow must be Failed/Error to resubmit in memoized mode","messagePattern":"workflow must be Failed/Error to resubmit in memoized mode","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/util/util.go","lineNumber":767,"sourceCode":"func FormulateResubmitWorkflow(ctx context.Context, wf *wfv1.Workflow, memoized bool, parameters []string) (*wfv1.Workflow, error) {\n\tlog := logging.RequireLoggerFromContext(ctx)\n\tnewWF := wfv1.Workflow{}\n\tnewWF.TypeMeta = wf.TypeMeta\n\n\t// Resubmitted workflow will use generated names\n\tif wf.GenerateName != \"\" {\n\t\tnewWF.GenerateName = wf.GenerateName\n\t} else {\n\t\tnewWF.GenerateName = wf.Name + \"-\"\n\t}\n\t// When resubmitting workflow with memoized nodes, we need to use a predetermined workflow name\n\t// in order to formulate the node statuses. Which means we cannot reuse metadata.generateName\n\t// The following simulates the behavior of generateName\n\tif memoized {\n\t\tswitch wf.Status.Phase {\n\t\tcase wfv1.WorkflowFailed, wfv1.WorkflowError:\n\t\tdefault:\n\t\t\treturn nil, errors.Errorf(errors.CodeBadRequest, \"workflow must be Failed/Error to resubmit in memoized mode\")\n\t\t}\n\t\tnewWF.Name = newWF.GenerateName + RandSuffix()\n\t}\n\n\t// carry over the unmodified spec\n\tnewWF.Spec = wf.Spec\n\n\tif newWF.Spec.ActiveDeadlineSeconds != nil && *newWF.Spec.ActiveDeadlineSeconds == 0 {\n\t\t// if it was terminated, unset the deadline\n\t\tnewWF.Spec.ActiveDeadlineSeconds = nil\n\t}\n\n\tnewWF.Spec.Shutdown = \"\"\n\n\t// carry over user labels and annotations from previous workflow.\n\tif newWF.Labels == nil {\n\t\tnewWF.Labels = make(map[string]string)\n\t}","sourceCodeStart":749,"sourceCodeEnd":785,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/util/util.go#L749-L785","documentation":"FormulateResubmitWorkflow in workflow/util/util.go builds a new workflow spec when resubmitting. In memoized mode the new run reuses the original node statuses, which is only meaningful for workflows that already reached a terminal failure. If wf.Status.Phase is anything other than WorkflowFailed or WorkflowWorkflowError when memoized is true, it returns a coded 400 (errors.CodeBadRequest) refusing the resubmit.","triggerScenarios":"Calling FormulateResubmitWorkflow (via ResubmitWorkflow / ResubmitArchivedWorkflow, or `argo resubmit --memoized`) on a workflow whose status.phase is Running, Pending, Succeeded, or empty while the memoized option is enabled.","commonSituations":"Running `argo resubmit <wf> --memoized` on a currently running workflow; resubmitting a succeeded workflow with --memoized expecting incremental behavior (that is retry's job, not resubmit's); scripting that always passes memoized=true without checking phase.","solutions":["Wait until the workflow reaches Failed or Error phase before resubmitting with --memoized (poll `argo get <wf>` or watch phase).","Drop the --memoized flag to do a plain resubmit of a running/succeeded workflow.","If the goal is rerunning parts of a succeeded workflow, use `argo retry --restart-successful --node-field-selector ...` instead."],"exampleFix":"# before\nargo resubmit my-wf --memoized        # my-wf is Running\n# after\nargo wait my-wf && argo resubmit my-wf --memoized   # only if it ended Failed/Error\n# or, without memoization:\nargo resubmit my-wf","handlingStrategy":"validation","validationCode":"// Go: check phase before memoized resubmit\nif memoized && wf.Status.Phase != wfv1.WorkflowFailed && wf.Status.Phase != wfv1.WorkflowError {\n\treturn fmt.Errorf(\"workflow %s is %s; memoized resubmit requires Failed/Error\", wf.Name, wf.Status.Phase)\n}","typeGuard":null,"tryCatchPattern":"// Go: catch the 400 and fall back to a plain resubmit\nnewWF, err := util.FormulateResubmitWorkflow(ctx, wf, \"\", true)\nif err != nil {\n\tif argoErr, ok := err.(errors.ArgoError); ok && argoErr.Code() == errors.CodeBadRequest {\n\t\tnewWF, err = util.FormulateResubmitWorkflow(ctx, wf, \"\", false) // non-memoized\n\t}\n}","preventionTips":["Only pass --memoized for workflows known to have ended Failed or Error.","Gate memoized resubmits in automation on `argo get` phase output.","Remember: memoized resubmit reuses node statuses — it is meaningless for running or succeeded runs.","For succeeded workflows needing partial reruns, use retry with restartSuccessful instead."],"tags":["resubmit","memoization","workflow-phase","bad-request"],"backgroundTag":"invalid-workflow-phase","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}