hashicorp/nomad · error

unable to find task group in the job summary: %v

Error message

unable to find task group in the job summary: %v

What it means

This error is thrown by Nomad's StateStore while updating a job's summary during allocation changes. The code looks up the allocation's task group in the job's summary map (jobSummary.Summary); if the key is absent, the state store cannot apply the allocation change to the group's counts, so the transaction is aborted with this error. It indicates internal state inconsistency: the allocation references a task group the job summary does not track.

Source

Thrown at nomad/state/state_store.go:6087

		if rawJob == nil {
			return nil
		}

		return fmt.Errorf("job summary for job %q in namespace %q is not present", alloc.JobID, alloc.Namespace)
	}

	// Get a copy of the existing summary
	jobSummary := summaryRaw.(*structs.JobSummary).Copy()

	// Not updating the job summary because the allocation doesn't belong to the
	// currently registered job
	if jobSummary.CreateIndex != alloc.Job.CreateIndex {
		return nil
	}

	tgSummary, ok := jobSummary.Summary[alloc.TaskGroup]
	if !ok {
		return fmt.Errorf("unable to find task group in the job summary: %v", alloc.TaskGroup)
	}

	summaryChanged := false
	if existingAlloc == nil {
		switch alloc.DesiredStatus {
		case structs.AllocDesiredStatusStop, structs.AllocDesiredStatusEvict:
			s.logger.Error("new allocation inserted into state store with bad desired status",
				"alloc_id", alloc.ID, "desired_status", alloc.DesiredStatus)
		}
		switch alloc.ClientStatus {
		case structs.AllocClientStatusPending:
			tgSummary.Starting += 1
			if tgSummary.Queued > 0 {
				tgSummary.Queued -= 1
			}
			summaryChanged = true
		case structs.AllocClientStatusRunning, structs.AllocClientStatusFailed,
			structs.AllocClientStatusComplete:

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Verify alloc.TaskGroup exactly matches the task group name in the job spec (names are case-sensitive)
  2. Re-snapshot or repair state: ensure the job_summary entry contains a Summary entry for every task group in the job before replaying allocs
  3. Check that the job was updated through the normal Job.Register path so the summary is regenerated for renamed/added groups
  4. If seen after a restore, re-run nomad operator raft / state restore from a consistent snapshot

Example fix

// before (alloc for a group missing from summary)
alloc.TaskGroup = "web-v2" // job spec has "web"
// after
alloc.TaskGroup = "web" // must match the group name registered in the job summary
Defensive patterns

Strategy: validation

Validate before calling

// Before writing an alloc (tooling/restore scripts): ensure the summary has the group
// (via Nomad API: GET /v1/job/<id>/summary)
const summary = await nomad.get(`/v1/job/${jobID}/summary`);
if (!summary.Summary[alloc.TaskGroup]) {
  throw new Error(`task group ${alloc.TaskGroup} missing from job ${jobID} summary; re-register the job first`);
}

Type guard

function hasTaskGroupSummary(summary, tg) {
  return summary && summary.Summary && Object.prototype.hasOwnProperty.call(summary.Summary, tg);
}

Try / catch

try {
  await nomad.allocsUpdate(alloc);
} catch (e) {
  if (String(e).includes('unable to find task group in the job summary')) {
    // re-register the job to rebuild summaries, then retry
    await nomad.post(`/v1/job/${alloc.JobID}`, jobSpec);
    await nomad.allocsUpdate(alloc);
  } else throw e;
}

Prevention

When it happens

Trigger: Upserting an allocation whose alloc.JobSummary.CreateIndex matches the job summary's CreateIndex (so the summary is considered current) but whose alloc.TaskGroup is not a key in jobSummary.Summary — e.g. state reconstructed from a snapshot/restore missing the group entry, or an allocation written for a task group removed/renamed in the job spec.

Common situations: Restoring Nomad state from a backup where the job_summary table predates a task-group rename; applying an alloc snapshot out of order; raft log replay after manual state surgery; bugs in job update paths that replace Summary map contents without the group key.

Related errors


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