hashicorp/nomad · critical

no task resources found on allocation

Error message

no task resources found on allocation

What it means

NewTaskRunner validates that the allocation carries AllocatedResources before building the runner. If tr.alloc.AllocatedResources is nil, the alloc has no resource assignment at all (malformed, pre-0.9-style, or partially written allocation), so the task cannot be started. The identical message is reused for the missing-task-entry case (error 709).

Source

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

		shutdownDelayCancelFn:   config.ShutdownDelayCancelFn,
		serviceRegWrapper:       config.ServiceRegWrapper,
		getter:                  config.Getter,
		wranglers:               config.Wranglers,
		widmgr:                  config.WIDMgr,
		users:                   config.Users,
	}

	// Create the logger based on the allocation ID
	tr.logger = config.Logger.Named("task_runner").With("task", config.Task.Name)

	// Create the pauser
	tr.pauser = newPauseGate(tr)

	tr.setHookStatsHandler(config.Alloc.Namespace)

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

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Inspect the alloc (nomad alloc status -json <id>) and confirm AllocatedResources is null; if so, resync by stopping/forcing the alloc (nomad alloc stop) so the server creates a replacement.
  2. Upgrade server and clients to matching, current Nomad versions — pre-0.9 allocs used Resources/TaskResources fields that no longer satisfy this path.
  3. If a client state corruption is suspected, stop the agent, back up and remove/repair the client state DB for the bad alloc, then restart the agent.
  4. Check server logs for the allocation creation path if it reproduces on fresh allocs (possible scheduler/upgrade bug).

Example fix

// before: stale alloc lacking AllocatedResources replayed from old client state
AllocatedResources: nil
// after: stop and let the scheduler place a fresh alloc
$ nomad alloc stop <alloc-id>  // new alloc gets AllocatedResources populated
Defensive patterns

Strategy: validation

Validate before calling

// guard before building task runners from a client-side alloc
if alloc.AllocatedResources == nil {
    return fmt.Errorf("alloc %s has no AllocatedResources; resync from server", alloc.ID)
}

Type guard

func allocHasResources(a *structs.Allocation) bool {
    return a != nil && a.AllocatedResources != nil && len(a.AllocatedResources.Tasks) > 0
}

Prevention

When it happens

Trigger: Creating a task runner via NewTaskRunner for an allocation whose AllocatedResources field is nil — e.g. an allocation object restored from an old/partially written state store, or an alloc handed to the client without a completed resources fit.

Common situations: Nomad client state (allocs dir / bolt state DB) containing allocations written by an older Nomad version then replayed after upgrade; corrupted or manually edited client state; server-side bug or downgrade producing allocs without AllocatedResources.

Related errors


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