{"record":{"id":"c745ecb0e3973a17","repo":"argoproj/argo-workflows","slug":"couldn-t-find-cluster-workflow-template-q","errorCode":null,"errorMessage":"couldn't find cluster workflow template %q","messagePattern":"couldn't find cluster workflow template %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apiclient/offline-client.go","lineNumber":163,"sourceCode":"}\n\nfunc (w offlineWorkflowTemplateNamespacedGetter) Get(_ context.Context, name string) (*wfv1.WorkflowTemplate, error) {\n\tif v, ok := w.workflowTemplates[name]; ok {\n\t\treturn v, nil\n\t}\n\treturn nil, fmt.Errorf(\"couldn't find workflow template %q in namespace %q\", name, w.namespace)\n}\n\ntype offlineClusterWorkflowTemplateGetter struct {\n\tclusterWorkflowTemplates map[string]*wfv1.ClusterWorkflowTemplate\n}\n\nfunc (o offlineClusterWorkflowTemplateGetter) Get(_ context.Context, name string) (*wfv1.ClusterWorkflowTemplate, error) {\n\tif v, ok := o.clusterWorkflowTemplates[name]; ok {\n\t\treturn v, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"couldn't find cluster workflow template %q\", name)\n}\n","sourceCodeStart":145,"sourceCodeEnd":165,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apiclient/offline-client.go#L145-L165","documentation":"offlineClusterWorkflowTemplateGetter.Get is the in-memory stand-in for the ClusterWorkflowTemplate service. If a cluster-scoped templateRef cannot be found among the loaded manifests, it returns this error naming the missing cluster template.","triggerScenarios":"During offline lint/templateresolution, a templateRef with clusterScope: true references a ClusterWorkflowTemplate name that was not included in the paths given to newOfflineClient.","commonSituations":"Linting workflow files without including the ClusterWorkflowTemplate manifest they depend on; typo in templateRef.name; forgetting that cluster templates live outside any namespace and were not part of the walked directory.","solutions":["Include the file defining the referenced ClusterWorkflowTemplate in the linted paths.","Correct the templateRef.name to match the defined cluster template.","List loaded cluster templates (or grep manifests for kind: ClusterWorkflowTemplate) to confirm the name exists."],"exampleFix":"// before\nargo lint ./workflow.yaml\n// after\nargo lint ./cluster-templates/ ./workflow.yaml","handlingStrategy":"validation","validationCode":"// collect cluster template names from manifests:\nclusterTmpls := map[string]bool{} // from kind: ClusterWorkflowTemplate docs\n// for each templateRef with clusterScope: if !clusterTmpls[ref.Name] { fail early }","typeGuard":null,"tryCatchPattern":"err := lint(ctx, paths)\nif err != nil && strings.Contains(err.Error(), \"couldn't find cluster workflow template\") {\n    // extract name, include its defining file in the offline client paths\n    return fmt.Errorf(\"missing ClusterWorkflowTemplate in lint input: %w\", err)\n}","preventionTips":["Include the cluster-template manifests whenever linting workflows that use clusterScope refs.","Grep for kind: ClusterWorkflowTemplate to build the expected name set before lint.","Validate templateRef.name against that set in CI."],"tags":["go","offline-mode","template-ref","cluster-workflow-template"],"backgroundTag":"template-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"}