{"record":{"id":"bb17f1dd0c0b386d","repo":"argoproj/argo-workflows","slug":"failed-to-get-existing-cluster-workflow-template","errorCode":null,"errorMessage":"failed to get existing cluster workflow template %q to update: %w","messagePattern":"failed to get existing cluster workflow template %q to update: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argo/commands/clustertemplate/update.go","lineNumber":63,"sourceCode":"\t\tcliOpts = &cliUpdateOpts{}\n\t}\n\tctx, apiClient, err := client.NewAPIClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tserviceClient, err := apiClient.NewClusterWorkflowTemplateServiceClient()\n\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":45,"sourceCodeEnd":76,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argo/commands/clustertemplate/update.go#L45-L76","documentation":"updateClusterWorkflowTemplates in `argo cluster-template update` first GETs each existing ClusterWorkflowTemplate to fetch its resourceVersion (required for a conflict-free k8s update). If the server-side GetClusterWorkflowTemplate call fails, the loop aborts with this wrapped error naming the template. It is a pre-update fetch failure, not the update itself failing.","triggerScenarios":"Calling `argo cluster-template update <files...>` where a template in the files does not yet exist on the cluster (Get returns NotFound), the user lacks RBAC permission to get clusterworkflowtemplates (cluster-scoped), or the argo server/k8s API is unreachable.","commonSituations":"Running update on templates never submitted before (should use `create` or `argo cluster-template lint`/install first); CI job using a service account without cluster-scoped get rights; wrong namespace/KUBECONFIG context pointing at a cluster missing the template; typo in template name in the manifest vs cluster.","solutions":["If the template may not exist, create it instead (or use `argo cluster-template update` only for existing templates) — check with `argo cluster-template get <name>` first","Fix RBAC: grant the caller's service account get/update on clusterworkflowtemplates.argoproj.io (ClusterRole)","Verify server connectivity and context: `argo cluster-template list` with the same KUBECONFIG/ARGO_SERVER settings","Correct the template Name in the manifest file so it matches an existing ClusterWorkflowTemplate"],"exampleFix":"// before (fails when template absent)\nargo cluster-template update ./templates\n// after (create or update based on existence)\nargo cluster-template get my-tmpl && argo cluster-template update ./templates || argo cluster-template create ./templates","handlingStrategy":"try-catch","validationCode":"argo cluster-template get \"$TMPL_NAME\" >/dev/null 2>&1 || { echo \"$TMPL_NAME missing; use create\"; exit 1; }","typeGuard":null,"tryCatchPattern":"err := runClusterTemplateUpdate(files)\nif err != nil && strings.Contains(err.Error(), \"failed to get existing cluster workflow template\") {\n    // template absent or RBAC denied: fall back to create or fix RBAC\n}","preventionTips":["Check template existence with get/list before update","Grant ClusterRole get/update on clusterworkflowtemplates.argoproj.io for CI identities","Pin KUBECONFIG/ARGO_SERVER per environment to avoid hitting the wrong cluster","Keep template names in files in sync with the cluster inventory"],"tags":["cli","kubernetes","rbac","argoproj"],"backgroundTag":"resource-not-found","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"}