hashicorp/nomad · error

Group name required

Error message

Group name required

What it means

`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.

Source

Thrown at command/job_scale.go:229

	// Truncate the ID unless full length is requested.
	length := shortId
	if verbose {
		length = fullId
	}

	// Detach was not specified, so start monitoring.
	mon := newMonitor(j.Meta, client, length)
	return mon.monitor(resp.EvalID)
}

// performGroupCheck performs logic to ensure the user specified the correct
// group argument.
func (j *JobScaleCommand) performGroupCheck(groups map[string]api.TaskGroupScaleStatus, group *string) error {

	// If the job contains multiple groups and the user did not supply a task
	// group, return an error.
	if len(groups) > 1 && *group == "" {
		return errors.New("Group name required")
	}

	// 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
		}
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Supply the group name: `nomad job scale <job> <group> <count>`.
  2. List groups first with `nomad job inspect <job>` or `nomad status <job>` to pick the right one.
  3. For single-group jobs this check is bypassed, but explicitly naming the group is safer long-term.

Example fix

// before
$ nomad job scale web 5
// after
$ nomad job scale web frontend 5
Defensive patterns

Strategy: validation

Validate before calling

job, _, err := client.Jobs().Info(jobID, nil)
if err == nil && len(job.TaskGroups) > 1 && groupName == "" {
    return errors.New("multi-group job: pass the task group name")
}

Try / catch

if err := jobScale(); err != nil && strings.Contains(err.Error(), "Group name required") {
    // list groups via nomad job inspect and re-run with group name
}

Prevention

When it happens

Trigger: Running `nomad job scale <job> <count>` without a group name on a job whose task group map has more than one entry.

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

Related errors


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