{"record":{"id":"ec33938647a2ee37","repo":"argoproj/argo-workflows","slug":"failed-to-update-cluster-workflow-template-s","errorCode":null,"errorMessage":"failed to update cluster workflow template: %s,  %w","messagePattern":"failed to update cluster workflow template: (.+?),  %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argo/commands/clustertemplate/update.go","lineNumber":70,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\n\tclusterWorkflowTemplates := generateClusterWorkflowTemplates(ctx, filePaths, cliOpts.strict)\n\n\tfor _, wftmpl := range clusterWorkflowTemplates {\n\t\tcurrent, err := serviceClient.GetClusterWorkflowTemplate(ctx, &clusterworkflowtemplate.ClusterWorkflowTemplateGetRequest{\n\t\t\tName: wftmpl.Name,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get existing cluster workflow template %q to update: %w\", wftmpl.Name, err)\n\t\t}\n\t\twftmpl.ResourceVersion = current.ResourceVersion\n\t\tupdated, err := serviceClient.UpdateClusterWorkflowTemplate(ctx, &clusterworkflowtemplate.ClusterWorkflowTemplateUpdateRequest{\n\t\t\tTemplate: &wftmpl,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to update cluster workflow template: %s,  %w\", wftmpl.Name, err)\n\t\t}\n\t\tprintClusterWorkflowTemplate(updated, cliOpts.output.String())\n\t}\n\treturn nil\n}\n","sourceCodeStart":52,"sourceCodeEnd":76,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argo/commands/clustertemplate/update.go#L52-L76","documentation":"After fetching the current resourceVersion, updateClusterWorkflowTemplates calls serviceClient.UpdateClusterWorkflowTemplate for each template. If that server-side update fails, the loop returns this error wrapping the underlying cause with the template name. Typical underlying causes are OptimizedConflict (resourceVersion changed concurrently), validation rejection, or RBAC denial.","triggerScenarios":"`argo cluster-template update` when: another writer modified the ClusterWorkflowTemplate between the Get and Update (stale resourceVersion → conflict); the updated spec fails server-side validation; the identity lacks update permission on clusterworkflowtemplates; the argo server cannot reach the k8s API.","commonSituations":"Two CI pipelines updating the same ClusterWorkflowTemplate concurrently; editing a template whose stored version was bumped by a controller/other user mid-run; admission webhooks or CRD validation rejecting new field values.","solutions":["Re-run `argo cluster-template update` — a fresh Get picks up the new resourceVersion and the retry usually succeeds","Serialize updates: ensure only one pipeline/process updates a given template at a time (locks, separate files per team)","Inspect the wrapped error (%w) for a validation message and fix the offending fields in the manifest","Fix RBAC so the caller's identity can update clusterworkflowtemplates.argoproj.io"],"exampleFix":"// before\nargo cluster-template update ./templates   # fails with conflict under concurrent writers\n// after\nfor i in 1 2 3; do argo cluster-template update ./templates && break || sleep 5; done","handlingStrategy":"retry","validationCode":"// pre-check no concurrent writers: capture resourceVersion and re-check\nargo cluster-template get \"$TMPL_NAME\" -o json | jq -r '.metadata.resourceVersion'","typeGuard":null,"tryCatchPattern":"for i in 1 2 3 4 5; do\n  argo cluster-template update \"$f\" && break\n  case $? in 0) break;; *) sleep $((i*5));; esac\ndone","preventionTips":["Serialize updates per template across pipelines (locks/queues)","Always re-Get before Update so resourceVersion is fresh","Keep one canonical source (GitOps) for each ClusterWorkflowTemplate","Read the wrapped error to distinguish conflict (retry) from validation (fix manifest)"],"tags":["cli","kubernetes","concurrency","argoproj"],"backgroundTag":"resource-version-conflict","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}