hashicorp/nomad · error

task group volume claim does not exist

Error message

task group volume claim does not exist

What it means

TaskGroupHostVolumeClaim.Delete looks up the claim by (namespace, ClaimID) in the state store before issuing the Raft delete. If no claim with that ID exists in the namespace, it returns this error instead of applying a no-op delete. It is an existence check, not a permissions or Raft failure.

Source

Thrown at nomad/task_group_host_volume_claim_endpoint.go:139

	}
	if !allowClaim(aclObj, args.RequestNamespace()) {
		return structs.ErrPermissionDenied
	}

	if args.ClaimID == "" {
		return fmt.Errorf("missing claim ID to delete")
	}

	snap, err := tgvc.srv.State().Snapshot()
	if err != nil {
		return err
	}
	claim, err := snap.TaskGroupHostVolumeClaimByID(nil, args.RequestNamespace(), args.ClaimID)
	if err != nil {
		return err
	}
	if claim == nil {
		return fmt.Errorf("task group volume claim does not exist")
	}

	_, index, err := tgvc.srv.raftApply(structs.TaskGroupHostVolumeClaimDeleteRequestType, args)
	if err != nil {
		return err
	}

	reply.Index = index
	return nil
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Verify the claim ID and namespace are correct (list claims in the target namespace)
  2. Treat this as success if the goal is idempotent cleanup of the claim
  3. Retry the list operation if the claim was just created — Raft replication lag can briefly hide it
  4. Use the same namespace the claim was created in

Example fix

// before
c.Delete(claimID) // panics/fails if claimID already gone

// after
claim, _ := c.GetClaim(claimID)
if claim != nil {
    c.Delete(claimID)
}
Defensive patterns

Strategy: validation

Validate before calling

claim, err := client.HostVolumes().GetClaim(ns, claimID, nil)
if err != nil || claim == nil {
    return fmt.Errorf("claim %q not found in namespace %q; nothing to delete", claimID, ns)
}

Type guard

claimExists := func(c *api.TaskGroupHostVolumeClaim) bool { return c != nil && c.ID != "" }

Try / catch

err := client.HostVolumes().DeleteClaim(ns, claimID, nil)
if err != nil && strings.Contains(err.Error(), "does not exist") {
    // idempotent cleanup: treat as already-deleted success
}

Prevention

When it happens

Trigger: Deleting a task group host volume claim whose ClaimID does not exist in the request namespace (already deleted, wrong namespace, or typo in ID).

Common situations: Double-delete races in automation; deleting a claim in the wrong namespace; stale caches referencing a claim removed by another operator or by job deregistration.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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