{"record":{"id":"0bcdc6a96df677b7","repo":"argoproj/argo-workflows","slug":"containers-s","errorCode":null,"errorMessage":"containers%s","messagePattern":"containers(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/workflow/v1alpha1/container_set_template_types.go","lineNumber":101,"sourceCode":"\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// Validate checks if the ContainerSetTemplate is valid\nfunc (in *ContainerSetTemplate) Validate() error {\n\tif len(in.Containers) == 0 {\n\t\treturn fmt.Errorf(\"containers must have at least one container\")\n\t}\n\n\tnames := make([]string, 0)\n\tfor _, ctr := range in.Containers {\n\t\tnames = append(names, ctr.Name)\n\t}\n\terr := validateWorkflowFieldNames(names, false)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"containers%s\", err.Error())\n\t}\n\n\t// Ensure there are no collisions with volume mountPaths and artifact load paths\n\tmountPaths := make(map[string]string)\n\tfor i, volMount := range in.VolumeMounts {\n\t\tif prev, ok := mountPaths[volMount.MountPath]; ok {\n\t\t\treturn fmt.Errorf(\"volumeMounts[%d].mountPath '%s' already mounted in %s\", i, volMount.MountPath, prev)\n\t\t}\n\t\tmountPaths[volMount.MountPath] = fmt.Sprintf(\"volumeMounts.%s\", volMount.Name)\n\t}\n\n\t// Ensure the dependencies are defined\n\tnameToContainer := make(map[string]ContainerNode)\n\tfor _, ctr := range in.Containers {\n\t\tnameToContainer[ctr.Name] = ctr\n\t}\n\tfor _, ctr := range in.Containers {\n\t\tfor _, depName := range ctr.Dependencies {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apis/workflow/v1alpha1/container_set_template_types.go#L83-L119","documentation":"Every container in a ContainerSetTemplate must have a valid, non-empty Kubernetes-legal name. Validate() runs the collected container names through validateWorkflowFieldNames and prefixes any failure with \"containers\", propagating the detailed reason from that validator.","triggerScenarios":"A container entry missing metadata/name, or using an invalid DNS-1123-subdomain-style name (uppercase letters, underscores, leading/trailing dashes, slashes) inside containerSet.containers.","commonSituations":"Unquoted names with special characters in YAML; templated names with spaces or uppercase from variables; forgetting the name field on a container entry.","solutions":["Give each container a valid name: lowercase alphanumeric, '-' or '.', starting and ending alphanumeric (e.g. main, sidecar-logs).","Read the suffix of the error message after \"containers\" for the exact validator complaint (empty or invalid index/name).","Quote YAML scalar names if using characters the YAML parser may misinterpret."],"exampleFix":"// before\ncontainerSet:\n  containers:\n    - name: My_Container\n      image: alpine\n// after\ncontainerSet:\n  containers:\n    - name: my-container\n      image: alpine","handlingStrategy":"validation","validationCode":"import \"regexp\"\nvar nameRe = regexp.MustCompile(`^[a-z0-9]([-a-z0-9.]*[a-z0-9])?$`)\nfor _, c := range cs.ContainerSet.Containers {\n    if c.Name == \"\" || !nameRe.MatchString(c.Name) {\n        return fmt.Errorf(\"invalid container name %q\", c.Name)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := cs.Validate(); err != nil {\n    if strings.HasPrefix(err.Error(), \"containers\") {\n        // parse validator detail after prefix, fix the named container\n    }\n    return err\n}","preventionTips":["Enforce lowercase DNS-1123 names in templates/variables.","Never leave the name field blank on containerSet containers.","Run argo lint in CI to catch naming before submit."],"tags":["go","validation","container-set","naming"],"backgroundTag":"invalid-resource-name","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"}