argoproj/argo-workflows · error
couldn't find workflow template %q in namespace %q
Error message
couldn't find workflow template %q in namespace %q
What it means
offlineWorkflowTemplateNamespacedGetter.Get is the in-memory stand-in for the WorkflowTemplate service. When a template referenced during lint/template resolution is not present in the store built from the given paths, Get returns this error naming the missing template and its namespace.
Source
Thrown at pkg/apiclient/offline-client.go:151
func (c *offlineClient) NewInfoServiceClient() (infopkg.InfoServiceClient, error) {
return nil, ErrNoArgoServer
}
func (c *offlineClient) NewSyncServiceClient(_ context.Context) (syncpkg.SyncServiceClient, error) {
return nil, ErrNoArgoServer
}
type offlineWorkflowTemplateNamespacedGetter struct {
namespace string
workflowTemplates map[string]*wfv1.WorkflowTemplate
}
func (w offlineWorkflowTemplateNamespacedGetter) Get(_ context.Context, name string) (*wfv1.WorkflowTemplate, error) {
if v, ok := w.workflowTemplates[name]; ok {
return v, nil
}
return nil, fmt.Errorf("couldn't find workflow template %q in namespace %q", name, w.namespace)
}
type offlineClusterWorkflowTemplateGetter struct {
clusterWorkflowTemplates map[string]*wfv1.ClusterWorkflowTemplate
}
func (o offlineClusterWorkflowTemplateGetter) Get(_ context.Context, name string) (*wfv1.ClusterWorkflowTemplate, error) {
if v, ok := o.clusterWorkflowTemplates[name]; ok {
return v, nil
}
return nil, fmt.Errorf("couldn't find cluster workflow template %q", name)
}
View on GitHub (pinned to 35bff19146)
Solutions
- Pass the file/directory containing the referenced WorkflowTemplate to lint (e.g. `argo lint ./templates ./workflow.yaml`).
- Fix the templateRef name/namespace typo so it matches the defined template.
- Verify metadata.namespace on the template matches the namespace the workflow expects.
Example fix
// before argo lint ./workflow.yaml // after argo lint ./manifests/ # includes the referenced WorkflowTemplate
Defensive patterns
Strategy: validation
Validate before calling
// before linting, collect defined names:
defined := map[string]bool{} // ns/name from parsed WorkflowTemplate docs
// for each templateRef: if !defined[ns+"/"+ref.Name] { fail early } Try / catch
err := lint(ctx, paths)
if err != nil && strings.Contains(err.Error(), "couldn't find workflow template") {
// extract name/namespace from err and include that manifest in paths
return fmt.Errorf("add the referenced template to lint paths: %w", err)
} Prevention
- Always lint whole manifest directories, not lone workflow files.
- Cross-check every templateRef name/namespace against defined templates in CI.
- Keep workflows and their referenced templates in the same repo/directory tree.
When it happens
Trigger: During `argo lint`, a workflow/templateRef points to a WorkflowTemplate name+namespace that was not defined in any of the files passed to the offline client.
Common situations: Linting only the workflow file but not the directory containing the referenced templates; typo in templateRef name; templateRef namespace not matching the template's namespace in the manifests; dependency defined in a file excluded by the path glob.
Related errors
- not supported when you are in offline mode
- duplicate ClusterWorkflowTemplate found: %q
- duplicate WorkflowTemplate found: %q
- couldn't find cluster workflow template %q
- failed to parse YAML from file %s: %w
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/269f38c02b40c6b2.
Report an issue: GitHub.