{"record":{"id":"71f928d42d2153e2","repo":"argoproj/argo-workflows","slug":"d-name-s-is-not-unique","errorCode":null,"errorMessage":"[%d].name '%s' is not unique","messagePattern":"\\[(.+?)\\]\\.name '(.+?)' is not unique","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/workflow/v1alpha1/validation_utils.go","lineNumber":67,"sourceCode":"func validateWorkflowFieldNames(names []string, isParamOrArtifact bool) error {\n\tnameSet := make(map[string]bool)\n\n\tfor i, name := range names {\n\t\tif name == \"\" {\n\t\t\treturn fmt.Errorf(\"[%d].name is required\", i)\n\t\t}\n\t\tvar errs []string\n\t\tif isParamOrArtifact {\n\t\t\terrs = isValidParamOrArtifactName(name)\n\t\t} else {\n\t\t\terrs = isValidWorkflowFieldName(name)\n\t\t}\n\t\tif len(errs) != 0 {\n\t\t\treturn fmt.Errorf(\"[%d].name: '%s' is invalid: %s\", i, name, strings.Join(errs, \";\"))\n\t\t}\n\t\t_, ok := nameSet[name]\n\t\tif ok {\n\t\t\treturn fmt.Errorf(\"[%d].name '%s' is not unique\", i, name)\n\t\t}\n\t\tnameSet[name] = true\n\t}\n\treturn nil\n}\n\n// validateNoCycles validates that a dependency graph has no cycles by doing a Depth-First Search\n// depGraph is an adjacency list, where key is a node name and value is a list of its dependencies' names\nfunc validateNoCycles(depGraph map[string][]string) error {\n\tvisited := make(map[string]bool)\n\tvar noCyclesHelper func(currentName string, cycyle []string) error\n\tnoCyclesHelper = func(currentName string, cycle []string) error {\n\t\tif _, ok := visited[currentName]; ok {\n\t\t\treturn nil\n\t\t}\n\t\tdepNames, ok := depGraph[currentName]\n\t\tif !ok {\n\t\t\treturn nil","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apis/workflow/v1alpha1/validation_utils.go#L49-L85","documentation":"This error comes from validateWorkflowFieldNames, a shared validator in Argo Workflows that checks that names inside a list field (template names, step names, etc.) are both syntactically valid and unique within the list. It throws when the same name appears twice in a list where every element must have a distinct name, because Argo references these elements by name and duplicates would be ambiguous.","triggerScenarios":"Calling Workflow.Validate (or the lint/submit path) on a WorkflowSpec/Template containing a list (e.g. spec.templates, steps) where two entries share the same metadata/name; the validator builds a nameSet and returns this error at the first duplicate.","commonSituations":"Copy-pasting a template block and forgetting to rename it; merging YAML fragments so a template name is defined twice; generated YAML scripts emitting the same name twice.","solutions":["Rename one of the duplicate entries so all names in the list are unique","Search the YAML for the reported name to find all occurrences","Run `argo lint` on the manifest before applying to catch duplicates early"],"exampleFix":"# before\ntemplates:\n- name: build\n  container: ...\n- name: build\n  container: ...\n# after\ntemplates:\n- name: build\n  container: ...\n- name: test\n  container: ...","handlingStrategy":"validation","validationCode":"func uniqueNames(names []string) error {\n    seen := map[string]bool{}\n    for _, n := range names {\n        if seen[n] {\n            return fmt.Errorf(\"duplicate name: %s\", n)\n        }\n        seen[n] = true\n    }\n    return nil\n}","typeGuard":"null","tryCatchPattern":"if err := wf.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"is not unique\") {\n        // surface the offending [i].name to the user\n    }\n    return err\n}","preventionTips":["Run `argo lint` before every apply/submit","Generate template names programmatically with a uniqueness guarantee","Review YAML merges/diffs for duplicated blocks"],"tags":["validation","workflow","yaml"],"backgroundTag":"duplicate-name-validation","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"}