{"record":{"id":"8176cf463ce000e1","repo":"hashicorp/nomad","slug":"group-v-not-found-within-job","errorCode":null,"errorMessage":"Group %v not found within job","messagePattern":"Group (.+?) not found within job","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/job_scale.go","lineNumber":250,"sourceCode":"\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}\n\n\t// If we got here, we didn't find a match and therefore return an error.\n\treturn fmt.Errorf(\"Group %v not found within job\", *group)\n}\n","sourceCodeStart":232,"sourceCodeEnd":252,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/job_scale.go#L232-L252","documentation":"Raised by `nomad job scale` in performGroupCheck when the group name supplied via -group (or positionally) does not match any TaskGroups entry in the job fetched from the Nomad API. The command iterates the job's task group names looking for an exact match, and returns this error when none matches, aborting the scale operation before any API write. It is a client-side validation error, not a server-side one.","triggerScenarios":"Running nomad job scale <job> <count> -group <name> where <name> is misspelled, has different casing, or the job was updated and the group was renamed/removed; also when the fetched job spec is stale relative to the running job.","commonSituations":"Typo in group name; scaling a group after a deploy renamed it; copying a scale command from another job; case mismatch (Nomad group names are case-sensitive); job uses meta templating so the rendered group differs from the source file.","solutions":["Run nomad job status <job> or nomad job inspect <job> and copy the exact group name from the TaskGroups list.","Fix the -group value spelling/casing to match the job spec exactly.","Re-render/confirm the current job file (nomad job inspect -json) in case a recent deploy renamed the group.","If the group genuinely no longer exists, scale a valid group or update the job spec instead."],"exampleFix":"// before\nnomad job scale web 5 -group api // Error: Group api not found within job\n// after\nnomad job inspect web | grep -i '\"Name\"'   # shows group is actually \"api-server\"\nnomad job scale web 5 -group api-server","handlingStrategy":"validation","validationCode":"const groups = JSON.parse(execSync(`nomad job inspect -json ${job}`).toString())\n  .Job.TaskGroups.map(g => g.Name);\nif (!groups.includes(groupName)) {\n  throw new Error(`Group \"${groupName}\" not in job; valid: ${groups.join(\", \")}`);\n}","typeGuard":"func groupExists(job *api.Job, name string) bool {\n    for _, tg := range job.TaskGroups {\n        if *tg.Name == name {\n            return true\n        }\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Copy group names from nomad job inspect/status output, not from memory or the HCL source file.","Remember group names are case-sensitive; use tab completion or list groups first.","Re-check group names after any deploy that might rename task groups.","Wrap scale commands in a script that validates the group against the live job before scaling."],"tags":["nomad","cli","validation","scaling"],"backgroundTag":"group-not-found","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"}