{"record":{"id":"1e31e29d192277a0","repo":"hashicorp/nomad","slug":"task-group-volume-claim-lookup-failed-v","errorCode":null,"errorMessage":"Task group volume claim lookup failed: %v","messagePattern":"Task group volume claim lookup failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/state/state_store_task_group_volume_claims.go","lineNumber":76,"sourceCode":"\t\treturn fmt.Errorf(\"Task group volume claim insert failed: %v\", err)\n\t}\n\n\t// Perform the index table update to mark the new insert.\n\tif err := txn.Insert(tableIndex, &IndexEntry{TableTaskGroupHostVolumeClaim, index}); err != nil {\n\t\treturn fmt.Errorf(\"index update failed: %v\", err)\n\t}\n\n\treturn nil\n}\n\n// GetTaskGroupHostVolumeClaim returns a volume claim that matches the namespace,\n// job id and task group name (there can be only one)\nfunc (s *StateStore) GetTaskGroupHostVolumeClaim(ws memdb.WatchSet, namespace, jobID, taskGroupName, volumeID string) (*structs.TaskGroupHostVolumeClaim, error) {\n\ttxn := s.db.ReadTxn()\n\n\twatchCh, existing, err := txn.FirstWatch(TableTaskGroupHostVolumeClaim, indexID, namespace, jobID, taskGroupName, volumeID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Task group volume claim lookup failed: %v\", err)\n\t}\n\tws.Add(watchCh)\n\n\tif existing != nil {\n\t\treturn existing.(*structs.TaskGroupHostVolumeClaim), nil\n\t}\n\n\treturn nil, nil\n}\n\n// GetTaskGroupHostVolumeClaims returns all volume claims\nfunc (s *StateStore) GetTaskGroupHostVolumeClaims(ws memdb.WatchSet) (memdb.ResultIterator, error) {\n\ttxn := s.db.ReadTxn()\n\n\titer, err := txn.Get(TableTaskGroupHostVolumeClaim, indexID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Task group volume claim lookup failed: %v\", err)\n\t}","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/state/state_store_task_group_volume_claims.go#L58-L94","documentation":"Wraps a memdb error from txn.FirstWatch while fetching a single TaskGroupHostVolumeClaim by (namespace, jobID, taskGroupName, volumeID). It means the read transaction itself failed, not that the claim is missing (missing claims return nil, nil). Read failures here are rare and indicate store-internal problems.","triggerScenarios":"Calling StateStore.GetTaskGroupHostVolumeClaim when the underlying read txn's FirstWatch on the claim table errors (corrupt index or table).","commonSituations":"Corrupted in-memory store after a crash; bugs in memdb index definitions; rarely seen in healthy clusters.","solutions":["Retry the read; transient txn errors are rare but possible","Check server logs for the underlying memdb error","Restart the Nomad server to reload state from Raft","Verify no external tooling mutated the data directory while the server was running"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"claim, err := store.GetTaskGroupHostVolumeClaim(ws, ns, jobID, tgName, volID)\nif err != nil {\n    if strings.Contains(err.Error(), \"lookup failed\") {\n        return retryRead()\n    }\n    return err\n}\nif claim == nil { /* not found — handle normally */ }","preventionTips":["Never conflate this error with 'claim not found' (err==nil, claim==nil)","Always pass a shared WatchSet so blocking queries behave correctly","Investigate server health if reads start failing"],"tags":["nomad","state-store","volume-claims","read"],"backgroundTag":"state-store-read-failed","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"}