argoproj/argo-workflows · error

[%d].name '%s' is not unique

Error message

[%d].name '%s' is not unique

What it means

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.

Source

Thrown at pkg/apis/workflow/v1alpha1/validation_utils.go:67

func validateWorkflowFieldNames(names []string, isParamOrArtifact bool) error {
	nameSet := make(map[string]bool)

	for i, name := range names {
		if name == "" {
			return fmt.Errorf("[%d].name is required", i)
		}
		var errs []string
		if isParamOrArtifact {
			errs = isValidParamOrArtifactName(name)
		} else {
			errs = isValidWorkflowFieldName(name)
		}
		if len(errs) != 0 {
			return fmt.Errorf("[%d].name: '%s' is invalid: %s", i, name, strings.Join(errs, ";"))
		}
		_, ok := nameSet[name]
		if ok {
			return fmt.Errorf("[%d].name '%s' is not unique", i, name)
		}
		nameSet[name] = true
	}
	return nil
}

// validateNoCycles validates that a dependency graph has no cycles by doing a Depth-First Search
// depGraph is an adjacency list, where key is a node name and value is a list of its dependencies' names
func validateNoCycles(depGraph map[string][]string) error {
	visited := make(map[string]bool)
	var noCyclesHelper func(currentName string, cycyle []string) error
	noCyclesHelper = func(currentName string, cycle []string) error {
		if _, ok := visited[currentName]; ok {
			return nil
		}
		depNames, ok := depGraph[currentName]
		if !ok {
			return nil

View on GitHub (pinned to 35bff19146)

Solutions

  1. Rename one of the duplicate entries so all names in the list are unique
  2. Search the YAML for the reported name to find all occurrences
  3. Run `argo lint` on the manifest before applying to catch duplicates early

Example fix

# before
templates:
- name: build
  container: ...
- name: build
  container: ...
# after
templates:
- name: build
  container: ...
- name: test
  container: ...
Defensive patterns

Strategy: validation

Validate before calling

func uniqueNames(names []string) error {
    seen := map[string]bool{}
    for _, n := range names {
        if seen[n] {
            return fmt.Errorf("duplicate name: %s", n)
        }
        seen[n] = true
    }
    return nil
}

Type guard

null

Try / catch

if err := wf.Validate(); err != nil {
    if strings.Contains(err.Error(), "is not unique") {
        // surface the offending [i].name to the user
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/71f928d42d2153e2. Report an issue: GitHub.