{"record":{"id":"6fb2366bfbd52ad9","repo":"hashicorp/nomad","slug":"group-name-required","errorCode":null,"errorMessage":"Group name required","messagePattern":"Group name required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/job_scale.go","lineNumber":229,"sourceCode":"\t// Truncate the ID unless full length is requested.\n\tlength := shortId\n\tif verbose {\n\t\tlength = fullId\n\t}\n\n\t// Detach was not specified, so start monitoring.\n\tmon := newMonitor(j.Meta, client, length)\n\treturn mon.monitor(resp.EvalID)\n}\n\n// performGroupCheck performs logic to ensure the user specified the correct\n// group argument.\nfunc (j *JobScaleCommand) performGroupCheck(groups map[string]api.TaskGroupScaleStatus, group *string) error {\n\n\t// If the job contains multiple groups and the user did not supply a task\n\t// group, return an error.\n\tif len(groups) > 1 && *group == \"\" {\n\t\treturn errors.New(\"Group name required\")\n\t}\n\n\t// We have to iterate the map to have any idea what task groups we are\n\t// dealing with.\n\tfor groupName := range groups {\n\n\t\t// If the job has a single task group, and the user did not supply a\n\t\t// task group, it is assumed we scale the only group in the job.\n\t\tif len(groups) == 1 && *group == \"\" {\n\t\t\t*group = groupName\n\t\t\treturn nil\n\t\t}\n\n\t\t// If we found a match, return.\n\t\tif groupName == *group {\n\t\t\treturn nil\n\t\t}\n\t}","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/job_scale.go#L211-L247","documentation":"`nomad job scale` scales a specific task group, so when the job has multiple groups the group name is mandatory. performGroupCheck returns this error when the job contains more than one group and the user left the group argument empty.","triggerScenarios":"Running `nomad job scale <job> <count>` without a group name on a job whose task group map has more than one entry.","commonSituations":"Single-group-era scripts applied to multi-group jobs; omitting the group assuming Nomad will infer it; job specs refactored to add sidecars, doubling group count.","solutions":["Supply the group name: `nomad job scale <job> <group> <count>`.","List groups first with `nomad job inspect <job>` or `nomad status <job>` to pick the right one.","For single-group jobs this check is bypassed, but explicitly naming the group is safer long-term."],"exampleFix":"// before\n$ nomad job scale web 5\n// after\n$ nomad job scale web frontend 5","handlingStrategy":"validation","validationCode":"job, _, err := client.Jobs().Info(jobID, nil)\nif err == nil && len(job.TaskGroups) > 1 && groupName == \"\" {\n    return errors.New(\"multi-group job: pass the task group name\")\n}","typeGuard":null,"tryCatchPattern":"if err := jobScale(); err != nil && strings.Contains(err.Error(), \"Group name required\") {\n    // list groups via nomad job inspect and re-run with group name\n}","preventionTips":["Always include the group argument: nomad job scale <job> <group> <count>.","Check group count with `nomad job inspect` before scaling programmatically.","Update legacy single-group scripts when job specs gain groups."],"tags":["cli","scaling","job","argument-required"],"backgroundTag":"ambiguous-target-missing-task","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}