{"record":{"id":"af6f554205a1be82","repo":"hashicorp/nomad","slug":"missing-alloc-bucket","errorCode":null,"errorMessage":"missing alloc bucket","messagePattern":"missing alloc bucket","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/state/db_bolt.go","lineNumber":272,"sourceCode":"func (s *BoltStateDB) getAllAllocations(tx *boltdd.Tx) ([]*structs.Allocation, map[string]error) {\n\tallocs := make([]*structs.Allocation, 0, 10)\n\terrs := map[string]error{}\n\n\tallocationsBkt := tx.Bucket(allocationsBucketName)\n\tif allocationsBkt == nil {\n\t\t// No allocs\n\t\treturn allocs, errs\n\t}\n\n\t// Create a cursor for iteration.\n\tc := allocationsBkt.BoltBucket().Cursor()\n\n\t// Iterate over all the allocation buckets\n\tfor k, _ := c.First(); k != nil; k, _ = c.Next() {\n\t\tallocID := string(k)\n\t\tallocBkt := allocationsBkt.Bucket(k)\n\t\tif allocBkt == nil {\n\t\t\terrs[allocID] = fmt.Errorf(\"missing alloc bucket\")\n\t\t\tcontinue\n\t\t}\n\n\t\tvar ae allocEntry\n\t\tif err := allocBkt.Get(allocKey, &ae); err != nil {\n\t\t\terrs[allocID] = fmt.Errorf(\"failed to decode alloc: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Handle upgrade path\n\t\tae.Alloc.Canonicalize()\n\t\tae.Alloc.Job.Canonicalize()\n\n\t\tallocs = append(allocs, ae.Alloc)\n\t}\n\n\treturn allocs, errs\n}","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/state/db_bolt.go#L254-L290","documentation":"In BoltStateDB.getAllAllocations, a per-allocation bucket under the allocations bucket is nil (corrupt or partially written state store entry); the alloc ID is recorded in the per-alloc error map and iteration continues rather than aborting the restore of all allocations.","triggerScenarios":"Thrown at client/state/db_bolt.go:272 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the Bolt state DB for corruption (boltdd check tooling)","Restore the client state database from a backup or let the client re-adopt allocations","Report per-alloc errors upstream instead of failing the entire listing"],"exampleFix":null,"handlingStrategy":"fallback","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"}