hashicorp/nomad · error

alloc missing task group

Error message

alloc missing task group

What it means

TaskRunner setup guard: tr.alloc.Job.LookupTaskGroup(tr.alloc.TaskGroup) returned nil while building the restart policy, meaning the allocation references a task group absent from its job - treated as corrupt alloc state and aborts task setup.

Source

Thrown at client/allocrunner/taskrunner/task_runner.go:464

	// Pull out the task's resources
	if tr.alloc.AllocatedResources == nil {
		return nil, fmt.Errorf("no task resources found on allocation")
	}

	if _, ok := tr.alloc.AllocatedResources.Tasks[tr.taskName]; !ok {
		return nil, fmt.Errorf("no task resources found on allocation")
	}

	tr.taskResources = tr.alloc.AllocatedResources.Tasks[tr.taskName].Copy()

	// Build the restart tracker.
	rp := config.Task.RestartPolicy
	if rp == nil {
		tg := tr.alloc.Job.LookupTaskGroup(tr.alloc.TaskGroup)
		if tg == nil {
			tr.logger.Error("alloc missing task group")
			return nil, fmt.Errorf("alloc missing task group")
		}
		rp = tg.RestartPolicy
	}
	tr.restartTracker = restarts.NewRestartTracker(rp, tr.alloc.Job.Type, config.Task.Lifecycle)

	// Get the driver
	if err := tr.initDriver(); err != nil {
		tr.logger.Error("failed to create driver", "error", err)
		return nil, err
	}

	// Use the client secret only as the initial value; the identity hook will
	// update this with a workload identity if one is available
	tr.setNomadToken(config.ClientConfig.Node.SecretID)

	// Initialize the runners hooks. Must come after initDriver so hooks
	// can use tr.driverCapabilities
	tr.initHooks()

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Report as a bug; indicates alloc/job state mismatch on the client
  2. Check whether the alloc was restored from partial state
  3. Restart the client to re-sync alloc state from servers
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at client/allocrunner/taskrunner/task_runner.go:464 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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