hashicorp/nomad · error

Group %v not found within job

Error message

Group %v not found within job

What it means

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.

Source

Thrown at command/job_scale.go:250

	// We have to iterate the map to have any idea what task groups we are
	// dealing with.
	for groupName := range groups {

		// If the job has a single task group, and the user did not supply a
		// task group, it is assumed we scale the only group in the job.
		if len(groups) == 1 && *group == "" {
			*group = groupName
			return nil
		}

		// If we found a match, return.
		if groupName == *group {
			return nil
		}
	}

	// If we got here, we didn't find a match and therefore return an error.
	return fmt.Errorf("Group %v not found within job", *group)
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Run nomad job status <job> or nomad job inspect <job> and copy the exact group name from the TaskGroups list.
  2. Fix the -group value spelling/casing to match the job spec exactly.
  3. Re-render/confirm the current job file (nomad job inspect -json) in case a recent deploy renamed the group.
  4. If the group genuinely no longer exists, scale a valid group or update the job spec instead.

Example fix

// before
nomad job scale web 5 -group api // Error: Group api not found within job
// after
nomad job inspect web | grep -i '"Name"'   # shows group is actually "api-server"
nomad job scale web 5 -group api-server
Defensive patterns

Strategy: validation

Validate before calling

const groups = JSON.parse(execSync(`nomad job inspect -json ${job}`).toString())
  .Job.TaskGroups.map(g => g.Name);
if (!groups.includes(groupName)) {
  throw new Error(`Group "${groupName}" not in job; valid: ${groups.join(", ")}`);
}

Type guard

func groupExists(job *api.Job, name string) bool {
    for _, tg := range job.TaskGroups {
        if *tg.Name == name {
            return true
        }
    }
    return false
}

Prevention

When it happens

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

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

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/8176cf463ce000e1. Report an issue: GitHub.