{"record":{"id":"519ad17c0210fd0e","repo":"argoproj/argo-workflows","slug":"duplicate-workflowtemplate-found-q","errorCode":null,"errorMessage":"duplicate WorkflowTemplate found: %q","messagePattern":"duplicate WorkflowTemplate found: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apiclient/offline-client.go","lineNumber":83,"sourceCode":"\t\t\t\tswitch v := obj.(type) {\n\t\t\t\tcase *wfv1.ClusterWorkflowTemplate:\n\t\t\t\t\tif _, ok := clusterWorkflowTemplateGetter.clusterWorkflowTemplates[objName]; ok {\n\t\t\t\t\t\treturn fmt.Errorf(\"duplicate ClusterWorkflowTemplate found: %q\", objName)\n\t\t\t\t\t}\n\t\t\t\t\tclusterWorkflowTemplateGetter.clusterWorkflowTemplates[objName] = v\n\n\t\t\t\tcase *wfv1.WorkflowTemplate:\n\t\t\t\t\tgetter, ok := workflowTemplateGetters[namespace]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\tgetter = &offlineWorkflowTemplateNamespacedGetter{\n\t\t\t\t\t\t\tnamespace:         namespace,\n\t\t\t\t\t\t\tworkflowTemplates: map[string]*wfv1.WorkflowTemplate{},\n\t\t\t\t\t\t}\n\t\t\t\t\t\tworkflowTemplateGetters[namespace] = getter\n\t\t\t\t\t}\n\n\t\t\t\t\tif _, ok := getter.(*offlineWorkflowTemplateNamespacedGetter).workflowTemplates[objName]; ok {\n\t\t\t\t\t\treturn fmt.Errorf(\"duplicate WorkflowTemplate found: %q\", objName)\n\t\t\t\t\t}\n\t\t\t\t\tgetter.(*offlineWorkflowTemplateNamespacedGetter).workflowTemplates[objName] = v\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t}\n\n\treturn ctx, &offlineClient{\n\t\tclusterWorkflowTemplateGetter:       clusterWorkflowTemplateGetter,\n\t\tnamespacedWorkflowTemplateGetterMap: workflowTemplateGetters,\n\t}, nil\n}\n","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apiclient/offline-client.go#L65-L101","documentation":"Same duplicate-detection as ClusterWorkflowTemplates but namespaced: offline client stores WorkflowTemplates per namespace by name. Two WorkflowTemplates sharing a name within the same namespace in the linted manifests make the store ambiguous and abort with this error.","triggerScenarios":"Linting paths containing two WorkflowTemplates with identical metadata.name AND identical metadata.namespace (duplicates in different namespaces are allowed).","commonSituations":"Duplicated manifests in a directory passed to `argo lint`; accidentally rendering the same template twice with different values files but the same name; forgetting to change the name when creating a variant.","solutions":["Rename one of the conflicting WorkflowTemplates or change one's namespace.","Remove the redundant file/document from the linted set.","Search the manifests for `name: <offending>` under kind: WorkflowTemplate to locate both."],"exampleFix":"// before\nkind: WorkflowTemplate\nmetadata:\n  name: dup\n  namespace: default\n// after\nkind: WorkflowTemplate\nmetadata:\n  name: dup-alt\n  namespace: default","handlingStrategy":"validation","validationCode":"seen := map[string]bool{}\n// for each parsed WorkflowTemplate doc:\nkey := ns + \"/\" + name\nif seen[key] { return fmt.Errorf(\"duplicate WorkflowTemplate %s\", key) }\nseen[key] = true","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"duplicate WorkflowTemplate found\") {\n    // name is quoted inside err; locate both (namespace,name) occurrences and fix\n    return err\n}","preventionTips":["Names must be unique per namespace; verify with a pre-lint script.","Don't render the same template twice with different values files.","Namespace-scoped dedupe check in CI before `argo lint`."],"tags":["go","offline-mode","duplicate-resources","lint"],"backgroundTag":"duplicate-resource-definition","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"}