{"record":{"id":"8f077019238a3796","repo":"hashicorp/nomad","slug":"failed-to-retrieve-allocation-bucket-v","errorCode":null,"errorMessage":"failed to retrieve allocation bucket: %v","messagePattern":"failed to retrieve allocation bucket: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/state/db_bolt.go","lineNumber":704,"sourceCode":"\t\treturn nil, nil, err\n\t}\n\n\treturn ls, ts, nil\n}\n\n// PutTaskRunnerLocalState stores TaskRunner's LocalState or returns an error.\nfunc (s *BoltStateDB) PutTaskRunnerLocalState(allocID, taskName string, val *trstate.LocalState) error {\n\treturn s.db.Update(func(tx *boltdd.Tx) error {\n\t\treturn putTaskRunnerLocalStateImpl(tx, allocID, taskName, val)\n\t})\n}\n\n// putTaskRunnerLocalStateImpl stores TaskRunner's LocalState in an ongoing\n// transaction or returns an error.\nfunc putTaskRunnerLocalStateImpl(tx *boltdd.Tx, allocID, taskName string, val *trstate.LocalState) error {\n\ttaskBkt, err := getTaskBucket(tx, allocID, taskName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve allocation bucket: %v\", err)\n\t}\n\n\tif err := taskBkt.Put(taskLocalStateKey, val); err != nil {\n\t\treturn fmt.Errorf(\"failed to write task_runner state: %v\", err)\n\t}\n\n\treturn nil\n}\n\n// PutTaskState stores a task's state or returns an error.\nfunc (s *BoltStateDB) PutTaskState(allocID, taskName string, state *structs.TaskState) error {\n\treturn s.db.Update(func(tx *boltdd.Tx) error {\n\t\treturn putTaskStateImpl(tx, allocID, taskName, state)\n\t})\n}\n\n// putTaskStateImpl stores a task's state in an ongoing transaction or returns\n// an error.","sourceCodeStart":686,"sourceCodeEnd":722,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/state/db_bolt.go#L686-L722","documentation":"putTaskRunnerLocalStateImpl calls getTaskBucket to obtain/create the per-task bucket inside the alloc bucket; this error is returned when the bucket cannot be fetched or created, so persisting TaskRunner LocalState fails and the write transaction aborts.","triggerScenarios":"Thrown at client/state/db_bolt.go:704 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the alloc bucket exists (state not wiped mid-run)","Inspect DB health/permissions on the client state dir","Retry after transient bolt errors; recreate state via alloc re-adoption"],"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"}