argoproj/argo-workflows · error
failed to update workflow template: %w
Error message
failed to update workflow template: %w
What it means
After fetching the existing template's ResourceVersion, updateWorkflowTemplates calls UpdateWorkflowTemplate on the API server. If that call fails, the error is wrapped as `failed to update workflow template: %w`. The inner error carries the actual API failure — typically a validation rejection, conflict, or permission problem.
Source
Thrown at cmd/argo/commands/template/update.go:76
for _, wftmpl := range workflowTemplates {
if wftmpl.Namespace == "" {
wftmpl.Namespace = client.Namespace(ctx)
}
current, err := serviceClient.GetWorkflowTemplate(ctx, &workflowtemplatepkg.WorkflowTemplateGetRequest{
Name: wftmpl.Name,
Namespace: wftmpl.Namespace,
})
if err != nil {
return fmt.Errorf("failed to get existing workflow template %q to update: %w", wftmpl.Name, err)
}
wftmpl.ResourceVersion = current.ResourceVersion
updated, err := serviceClient.UpdateWorkflowTemplate(ctx, &workflowtemplatepkg.WorkflowTemplateUpdateRequest{
Namespace: wftmpl.Namespace,
Template: &wftmpl,
})
if err != nil {
return fmt.Errorf("failed to update workflow template: %w", err)
}
printWorkflowTemplate(updated, cliOpts.output.String())
}
return nil
}
View on GitHub (pinned to 35bff19146)
Solutions
- Inspect the wrapped error — validation errors list the offending field; fix the YAML/spec accordingly.
- Re-fetch the template and retry if the error is a conflict (stale ResourceVersion).
- Verify RBAC: the caller needs `update` on `workflowtemplates` in the target namespace.
- Run `argo lint` on the file before updating to catch spec errors client-side.
Example fix
// before argo template update bad.yaml # server rejects invalid spec // after argo lint bad.yaml # catch validation first argo template update bad.yaml
Defensive patterns
Strategy: retry
Validate before calling
argo lint file.yaml # validate spec before updating
Try / catch
for i := 0; i < 3; i++ {
_, err := client.UpdateWorkflowTemplate(ctx, req)
if err == nil { break }
if apierrors.IsConflict(err) { re-fetch resourceVersion; continue }
return err
} Prevention
- Re-fetch the template immediately before update to get a fresh ResourceVersion
- Run argo lint on the file before every update
- Check for concurrent writers (CI + humans) on the same template
- Verify update RBAC for the caller
When it happens
Trigger: The modified template fails schema/validation checks (invalid spec); a concurrent writer changed the ResourceVersion causing a conflict; RBAC denies `update workflowtemplates`; template is immutable in some field (e.g. changing certain metadata).
Common situations: Editing a spec with a schema error (bad template syntax) caught server-side; two operators updating the same template simultaneously; CI service account lacking update RBAC.
Related errors
- failed to get existing workflow template %q to update: %w
- ${e.Usage()}
- --completed and --running cannot be used together
- unable to parse node field selector '%s': %w
- unable to parse node field selector '%s': %w
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/3b4bcd7d9719da69.
Report an issue: GitHub.