{"record":{"id":"c46f12833db74e1c","repo":"argoproj/argo-workflows","slug":"d-name-is-required","errorCode":null,"errorMessage":"[%d].name is required","messagePattern":"\\[(.+?)\\]\\.name is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/workflow/v1alpha1/validation_utils.go","lineNumber":54,"sourceCode":"\t}\n\tif !workflowFieldNameRegex.MatchString(name) {\n\t\tmsg := workflowFieldNameErrMsg + \" (e.g. My-name1-2, 123-NAME)\"\n\t\terrs = append(errs, msg)\n\t}\n\treturn errs\n}\n\n// validateWorkflowFieldNames accepts a slice of strings and\n// verifies that the Name field of the structs are:\n// * unique\n// * non-empty\n// * matches matches our regex requirements\nfunc 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}","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apis/workflow/v1alpha1/validation_utils.go#L36-L72","documentation":"validateWorkflowFieldNames verifies that struct Name fields in a slice (params, artifacts, steps, containers, etc.) are non-empty, unique, and regex-valid. This guard fires with the element's index when a name is empty, identifying which list item in the spec is missing its required name during template/workflow validation.","triggerScenarios":"Thrown at pkg/apis/workflow/v1alpha1/validation_utils.go:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a non-empty name to the element at the reported index"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}