{"record":{"id":"d5f89e212839055a","repo":"hashicorp/nomad","slug":"alloc-insert-failed-v","errorCode":null,"errorMessage":"alloc insert failed: %v","messagePattern":"alloc insert failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/state/state_store.go","lineNumber":4171,"sourceCode":"\tif err := s.updateSummaryWithAlloc(index, copyAlloc, exist, txn); err != nil {\n\t\treturn nil, fmt.Errorf(\"error updating job summary: %v\", err)\n\t}\n\n\tif err := s.updateEntWithAlloc(index, copyAlloc, exist, txn); err != nil {\n\t\treturn nil, fmt.Errorf(\"error updating enterprise features: %v\", err)\n\t}\n\n\tif err := s.updatePluginForTerminalAlloc(index, copyAlloc, txn); err != nil {\n\t\treturn nil, fmt.Errorf(\"error updating plugin for terminal alloc: %v\", err)\n\t}\n\n\tif err := s.cancelFollowupEvalsForReconnect(txn, index, copyAlloc, alloc); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Update the allocation\n\tif err := txn.Insert(\"allocs\", copyAlloc); err != nil {\n\t\treturn nil, fmt.Errorf(\"alloc insert failed: %v\", err)\n\t}\n\n\tif err := s.deregisterServicesForTerminalAllocs(txn, index, copyAlloc); err != nil {\n\t\treturn nil, fmt.Errorf(\"error deregistering services for terminal allocs: %v\", err)\n\t}\n\n\treturn copyAlloc, nil\n}\n\n// cancelFollowupEvalsForReconnect cancels any follow-up evals for an allocation\n// that was awaiting reconnect and gets an update from the client that its\n// status is now known\nfunc (s *StateStore) cancelFollowupEvalsForReconnect(txn *txn, index uint64, copyAlloc, alloc *structs.Allocation) error {\n\n\tevalID, ok := copyAlloc.FollowupEvalForReconnect(alloc)\n\tif !ok {\n\t\treturn nil\n\t}","sourceCodeStart":4153,"sourceCodeEnd":4189,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/state/state_store.go#L4153-L4189","documentation":"Inserting the updated allocation into the memdb allocs table failed; the wrapped txn.Insert error aborts the allocation upsert inside the state store.","triggerScenarios":"Thrown at nomad/state/state_store.go:4171 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the allocation update","Check server logs for memdb write errors","Verify server/Raft health if inserts keep failing"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}