{"record":{"id":"d653d7207b2bcea5","repo":"hashicorp/nomad","slug":"task-state-entry-not-found","errorCode":null,"errorMessage":"task state entry not found","messagePattern":"task state entry not found","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/state/upgrade.go","lineNumber":296,"sourceCode":"\t\t\tlogger.Warn(\"deleting unexpected task state entry\",\n\t\t\t\t\"key\", string(k), \"value_bytes\", len(v),\n\t\t\t)\n\n\t\t\tif err := cur.Delete(); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error delting unexpected task key %q: %v\", string(k), err)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// Decode simple-all\n\t\tsimpleFound = true\n\t\tif err := codec.NewDecoderBytes(v, structs.MsgpackHandle).Decode(&trState); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to decode task state from 'simple-all' entry: %v\", err)\n\t\t}\n\t}\n\n\tif !simpleFound {\n\t\treturn nil, fmt.Errorf(\"task state entry not found\")\n\t}\n\n\treturn &trState, nil\n}\n\n// upgradeOldAllocMutable upgrades Nomad 0.8 alloc runner state.\nfunc upgradeOldAllocMutable(tx *boltdd.Tx, allocID string, oldBytes []byte) error {\n\tvar oldMutable allocRunnerMutableState08\n\terr := codec.NewDecoderBytes(oldBytes, structs.MsgpackHandle).Decode(&oldMutable)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Upgrade Deployment Status\n\tif err := putDeploymentStatusImpl(tx, allocID, oldMutable.DeploymentStatus); err != nil {\n\t\treturn err\n\t}\n","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/state/upgrade.go#L278-L314","documentation":"A 0.8 task bucket must contain a 'simple-all' key holding the task runner state. If iteration completes without finding it, upgradeTaskBucket returns this error; the caller warns and deletes the whole task bucket as invalid state.","triggerScenarios":"A task sub-bucket with no 'simple-all' entry (empty bucket, or all entries were deleted as unexpected keys) is processed during UpgradeAllocs.","commonSituations":"Task buckets created but never populated due to a 0.8 crash; state files tampered with or partially restored from backup; buckets left by interrupted previous upgrade attempts.","solutions":["Accept the drop: this error intentionally discards the task bucket; the task will restart fresh under 0.9+","If the task mattered, restore the pre-upgrade backup of client state and fix the 0.8 agent first","Stop nomad, back up, and clean the data_dir if migration errors cascade on many allocs","Confirm on disk (bolt browser) that the task bucket truly lacks 'simple-all' before suspecting a bug"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Go: detect legacy task buckets missing 'simple-all' before upgrading\nc := bkt.Cursor()\nfound := false\nfor k, v := c.First(); k != nil; k, v = c.Next() {\n    if v != nil && bytes.Equal(k, []byte(\"simple-all\")) {\n        found = true\n    }\n}\nif !found {\n    logger.Warn(\"task bucket has no simple-all entry; task state will be dropped and task restarted\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Back up pre-upgrade client state so tasks can be recovered if dropped","Ensure 0.8 agents shut down cleanly so task buckets are fully written","Expect task restarts after migration when state was incomplete","Inspect state.db with a bolt browser to confirm which buckets lack 'simple-all'"],"tags":["nomad","boltdb","state-migration"],"backgroundTag":"missing-state-entry","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"}