hashicorp/nomad · error

failed to get allocs for job '%s': %v

Error message

failed to get allocs for job '%s': %v

What it means

computeJobAllocs fetches all allocations for the eval's job via StateStore.AllocsByJob to reconcile them. A state store error aborts processing with this wrapped error. This is about the lookup failing, not about allocs being absent.

Source

Thrown at scheduler/generic_sched.go:334

	// a partial commit.
	fullCommit, expected, actual := result.FullCommit(s.plan)
	if !fullCommit {
		s.logger.Debug("plan didn't fully commit", "attempted", expected, "placed", actual)
		return false, fmt.Errorf("missing state refresh after partial commit")
	}

	// Success!
	return true, nil
}

// computeJobAllocs is used to reconcile differences between the job,
// existing allocations and node status to update the allocations.
func (s *GenericScheduler) computeJobAllocs() error {
	// Lookup the allocations by JobID
	ws := memdb.NewWatchSet()
	allocs, err := s.state.AllocsByJob(ws, s.eval.Namespace, s.eval.JobID, true)
	if err != nil {
		return fmt.Errorf("failed to get allocs for job '%s': %v",
			s.eval.JobID, err)
	}

	// Determine the tainted nodes containing job allocs
	tainted, err := taintedNodes(s.state, allocs)
	if err != nil {
		return fmt.Errorf("failed to get tainted nodes for job '%s': %v",
			s.eval.JobID, err)
	}

	// Update the allocations which are in pending/running state on tainted
	// nodes to lost, but only if the scheduler has already marked them
	updateNonTerminalAllocsToLost(s.plan, tainted, allocs)

	r := reconciler.NewAllocReconciler(s.logger,
		genericAllocUpdateFn(s.ctx, s.stack, s.eval.ID),
		reconciler.ReconcilerState{
			Job:               s.job,

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Read the wrapped underlying error to identify the root cause
  2. Retry — failed evals are reprocessed by Nomad
  3. Check server/raft health; restore from snapshot if corruption is suspected
  4. Reduce server load or upgrade Nomad if the issue recurs
Defensive patterns

Strategy: retry

Validate before calling

nomad job status <job-id> // confirms job allocs are retrievable and cluster is healthy

Try / catch

// Inspect the wrapped error in server logs; rely on eval retry
nomad eval list | grep -i failed

Prevention

When it happens

Trigger: StateStore.AllocsByJob(ws, eval.Namespace, eval.JobID, true) returns an error during computeJobAllocs — memdb failure, closed snapshot, index iteration error.

Common situations: Nomad server state store instability, resource exhaustion, raft restore, or version-specific state store bugs.

Related errors


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