{"record":{"id":"269f38c02b40c6b2","repo":"argoproj/argo-workflows","slug":"couldn-t-find-workflow-template-q-in-namespace-q","errorCode":null,"errorMessage":"couldn't find workflow template %q in namespace %q","messagePattern":"couldn't find workflow template %q in namespace %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apiclient/offline-client.go","lineNumber":151,"sourceCode":"\nfunc (c *offlineClient) NewInfoServiceClient() (infopkg.InfoServiceClient, error) {\n\treturn nil, ErrNoArgoServer\n}\n\nfunc (c *offlineClient) NewSyncServiceClient(_ context.Context) (syncpkg.SyncServiceClient, error) {\n\treturn nil, ErrNoArgoServer\n}\n\ntype offlineWorkflowTemplateNamespacedGetter struct {\n\tnamespace         string\n\tworkflowTemplates map[string]*wfv1.WorkflowTemplate\n}\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":133,"sourceCodeEnd":165,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apiclient/offline-client.go#L133-L165","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nargo lint ./workflow.yaml\n// after\nargo lint ./manifests/  # includes the referenced WorkflowTemplate","handlingStrategy":"validation","validationCode":"// before linting, collect defined names:\ndefined := map[string]bool{} // ns/name from parsed WorkflowTemplate docs\n// for each templateRef: if !defined[ns+\"/\"+ref.Name] { fail early }","typeGuard":null,"tryCatchPattern":"err := lint(ctx, paths)\nif err != nil && strings.Contains(err.Error(), \"couldn't find workflow template\") {\n    // extract name/namespace from err and include that manifest in paths\n    return fmt.Errorf(\"add the referenced template to lint paths: %w\", err)\n}","preventionTips":["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."],"tags":["go","offline-mode","template-ref","lint"],"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"}