hashicorp/nomad · warning

task %q in group %q defines services, but has no shutdown_de

Error message

task %q in group %q defines services, but has no shutdown_delay set

What it means

Although the snippet's message text at structs.go:4947 is 'task %q in group %q defines services, but has no shutdown_delay set', the source region shows the group-level warning that fires when the group has unscoped (group-level) services and neither the group nor any of its tasks set shutdown_delay — i.e. 'group %q defines services, but neither the group nor any of its tasks have shutdown_delay set'. It is a warning appended by TaskGroup.Warnings.

Source

Thrown at nomad/structs/structs.go:4947

	for _, t := range tg.Tasks {
		if _, ok := referencedTaskIDs[t.Name]; ok && t.ShutdownDelay == 0 {
			warnings = append(warnings, fmt.Errorf(
				"group %q references task %q in a service definition, but the task has no shutdown_delay set",
				tg.Name, t.Name))
		}

		if t.ShutdownDelay > 0 {
			anyTaskHasShutdownDelay = true
		} else if len(t.Services) > 0 {
			warnings = append(warnings, fmt.Errorf(
				"task %q in group %q defines services, but has no shutdown_delay set",
				t.Name, tg.Name))
		}
	}

	if hasUnscopedGroupService && !hasGroupShutdownDelay && !anyTaskHasShutdownDelay {
		warnings = append(warnings, fmt.Errorf(
			"group %q defines services, but neither the group nor any of its tasks have shutdown_delay set", tg.Name))
	}

	return warnings
}

// Warnings returns a list of warnings that may be from dubious settings or
// deprecation warnings.
func (j *Job) Warnings() error {
	var mErr multierror.Error

	// Check the groups
	hasAutoPromote, allAutoPromote := false, true

	for _, tg := range j.TaskGroups {
		if err := tg.Warnings(j); err != nil {
			outer := fmt.Errorf("Group %q has warnings: %v", tg.Name, err)
			mErr.Errors = append(mErr.Errors, outer)

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set `shutdown_delay` on the task group, or on at least one task in the group.
  2. Or set it on the connect sidecar_task if that is the relevant process.
  3. Re-validate with `nomad job validate` to confirm.

Example fix

// before
group "web" {
  service { name = "web"; connect { sidecar_service {} } }
}
// after
group "web" {
  shutdown_delay = "5s"
  service { name = "web"; connect { sidecar_service {} } }
}
Defensive patterns

Strategy: validation

Validate before calling

if len(group.Services) > 0 && group.ShutdownDelay == 0 &&
   !anyTaskHasShutdownDelay(group) {
    log.Warnf("group %q defines services with no shutdown_delay anywhere", group.Name)
}

Prevention

When it happens

Trigger: A task group defines group-level `service` blocks (hasUnscopedGroupService) while tg.ShutdownDelay is unset and no task in the group sets ShutdownDelay > 0. Rendered via job validation warnings and Meta.FormatWarnings.

Common situations: Group-level connect services with default sidecars; groups migrated from job-level service configs; operators unaware group-level shutdown_delay exists.

Related errors


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