argoproj/argo-workflows · error
failed to get existing cluster workflow template %q to updat
Error message
failed to get existing cluster workflow template %q to update: %w
What it means
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.
Source
Thrown at cmd/argo/commands/clustertemplate/update.go:63
cliOpts = &cliUpdateOpts{}
}
ctx, apiClient, err := client.NewAPIClient(ctx)
if err != nil {
return err
}
serviceClient, err := apiClient.NewClusterWorkflowTemplateServiceClient()
if err != nil {
return err
}
clusterWorkflowTemplates := generateClusterWorkflowTemplates(ctx, filePaths, cliOpts.strict)
for _, wftmpl := range clusterWorkflowTemplates {
current, err := serviceClient.GetClusterWorkflowTemplate(ctx, &clusterworkflowtemplate.ClusterWorkflowTemplateGetRequest{
Name: wftmpl.Name,
})
if err != nil {
return fmt.Errorf("failed to get existing cluster workflow template %q to update: %w", wftmpl.Name, err)
}
wftmpl.ResourceVersion = current.ResourceVersion
updated, err := serviceClient.UpdateClusterWorkflowTemplate(ctx, &clusterworkflowtemplate.ClusterWorkflowTemplateUpdateRequest{
Template: &wftmpl,
})
if err != nil {
return fmt.Errorf("failed to update cluster workflow template: %s, %w", wftmpl.Name, err)
}
printClusterWorkflowTemplate(updated, cliOpts.output.String())
}
return nil
}
View on GitHub (pinned to 35bff19146)
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
Example fix
// before (fails when template absent) argo cluster-template update ./templates // after (create or update based on existence) argo cluster-template get my-tmpl && argo cluster-template update ./templates || argo cluster-template create ./templates
Defensive patterns
Strategy: try-catch
Validate before calling
argo cluster-template get "$TMPL_NAME" >/dev/null 2>&1 || { echo "$TMPL_NAME missing; use create"; exit 1; } Try / catch
err := runClusterTemplateUpdate(files)
if err != nil && strings.Contains(err.Error(), "failed to get existing cluster workflow template") {
// template absent or RBAC denied: fall back to create or fix RBAC
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- failed to update cluster workflow template: %s, %w
- failed to create cluster workflow template: %s, %w
- unknown output mode: %s
- invalid shell %q: supported shells are bash, zsh, and fish
- error converting %s: %w
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/bb17f1dd0c0b386d.
Report an issue: GitHub.