{"record":{"id":"0418233feef0e0fe","repo":"hashicorp/nomad","slug":"index-update-failed-w","errorCode":null,"errorMessage":"index update failed: %w","messagePattern":"index update failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"nomad/state/state_store_task_group_volume_claims.go","lineNumber":209,"sourceCode":"\tobj, err := txn.First(TableTaskGroupHostVolumeClaim, indexClaimID, claimID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"task group volume claim lookup failed: %v\", err)\n\t}\n\n\tif obj == nil {\n\t\treturn errors.New(\"task group volume claim does not exist\")\n\t}\n\tclaim := obj.(*structs.TaskGroupHostVolumeClaim)\n\tif claim.Namespace != ns {\n\t\treturn errors.New(\"task group volume claim does not exist\")\n\t}\n\n\tif err := txn.Delete(TableTaskGroupHostVolumeClaim, obj); err != nil {\n\t\treturn err\n\t}\n\n\tif err := txn.Insert(tableIndex, &IndexEntry{TableTaskGroupHostVolumeClaim, index}); err != nil {\n\t\treturn fmt.Errorf(\"index update failed: %w\", err)\n\t}\n\n\treturn txn.Commit()\n}\n\nfunc (s *StateStore) updateStickyVolumeClaimsFromAlloc(txn *txn, index uint64, alloc *structs.Allocation) error {\n\tvar node *structs.Node\n\tvar err error\n\ttg := alloc.Job.LookupTaskGroup(alloc.TaskGroup)\n\tif tg != nil {\n\t\tfor _, req := range tg.Volumes {\n\t\t\tif !req.Sticky {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif node == nil {\n\t\t\t\tnode, err = s.NodeByID(nil, alloc.NodeID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/state/state_store_task_group_volume_claims.go#L191-L227","documentation":"Wraps a txn.Insert failure while updating the index table entry for TableTaskGroupHostVolumeClaim after a successful claim deletion. Without the index bump, blocking queries for this table would not fire, so the transaction aborts and the claim remains. Indicates low-level store problems rather than user error.","triggerScenarios":"Calling DeleteTaskGroupHostVolumeClaim when the index-entry insert fails after txn.Delete succeeded; the error is returned via applyTaskGroupHostVolumeClaimDelete.","commonSituations":"Corrupted index tables; Nomad internal bugs; unhealthy or resource-starved servers; usually clustered with other state-store errors.","solutions":["Retry the claim deletion","Examine the wrapped (%w) memdb error in server logs","Restart the Nomad server to rebuild in-memory state from Raft","Restore from a known-good Raft snapshot or upgrade Nomad if corruption recurs"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := deleteClaim(claimID); err != nil {\n    if strings.Contains(err.Error(), \"index update failed\") {\n        return retryAfterBackoff()\n    }\n    return err\n}","preventionTips":["Retry — the aborted txn leaves the claim intact","Watch for correlated index-update failures across tables (sign of corruption)","Restart/restore the server from Raft snapshot if errors persist"],"tags":["nomad","state-store","index","volume-claims"],"backgroundTag":"state-store-write-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"}