{"record":{"id":"2ee081036ec900a2","repo":"hashicorp/nomad","slug":"task-group-volume-claim-does-not-exist-2ee081","errorCode":null,"errorMessage":"task group volume claim does not exist","messagePattern":"task group volume claim does not exist","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/task_group_host_volume_claim_endpoint.go","lineNumber":139,"sourceCode":"\t}\n\tif !allowClaim(aclObj, args.RequestNamespace()) {\n\t\treturn structs.ErrPermissionDenied\n\t}\n\n\tif args.ClaimID == \"\" {\n\t\treturn fmt.Errorf(\"missing claim ID to delete\")\n\t}\n\n\tsnap, err := tgvc.srv.State().Snapshot()\n\tif err != nil {\n\t\treturn err\n\t}\n\tclaim, err := snap.TaskGroupHostVolumeClaimByID(nil, args.RequestNamespace(), args.ClaimID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif claim == nil {\n\t\treturn fmt.Errorf(\"task group volume claim does not exist\")\n\t}\n\n\t_, index, err := tgvc.srv.raftApply(structs.TaskGroupHostVolumeClaimDeleteRequestType, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treply.Index = index\n\treturn nil\n}\n","sourceCodeStart":121,"sourceCodeEnd":150,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/task_group_host_volume_claim_endpoint.go#L121-L150","documentation":"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.","triggerScenarios":"Deleting a task group host volume claim whose ClaimID does not exist in the request namespace (already deleted, wrong namespace, or typo in ID).","commonSituations":"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.","solutions":["Verify the claim ID and namespace are correct (list claims in the target namespace)","Treat this as success if the goal is idempotent cleanup of the claim","Retry the list operation if the claim was just created — Raft replication lag can briefly hide it","Use the same namespace the claim was created in"],"exampleFix":"// before\nc.Delete(claimID) // panics/fails if claimID already gone\n\n// after\nclaim, _ := c.GetClaim(claimID)\nif claim != nil {\n    c.Delete(claimID)\n}","handlingStrategy":"validation","validationCode":"claim, err := client.HostVolumes().GetClaim(ns, claimID, nil)\nif err != nil || claim == nil {\n    return fmt.Errorf(\"claim %q not found in namespace %q; nothing to delete\", claimID, ns)\n}","typeGuard":"claimExists := func(c *api.TaskGroupHostVolumeClaim) bool { return c != nil && c.ID != \"\" }","tryCatchPattern":"err := client.HostVolumes().DeleteClaim(ns, claimID, nil)\nif err != nil && strings.Contains(err.Error(), \"does not exist\") {\n    // idempotent cleanup: treat as already-deleted success\n}","preventionTips":["Verify claim ID and namespace with a lookup before delete","Write idempotent cleanup code that tolerates already-deleted claims","Watch for double-delete races in concurrent automation"],"tags":["nomad","volumes","not-found","claims"],"backgroundTag":"resource-not-found","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}