{"record":{"id":"f793fb864f866f00","repo":"hashicorp/nomad","slug":"failed-to-decode-task-state-from-simple-all-entr","errorCode":null,"errorMessage":"failed to decode task state from 'simple-all' entry: %v","messagePattern":"failed to decode task state from 'simple-all' entry: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/state/upgrade.go","lineNumber":291,"sourceCode":"\t\t\tcontinue\n\t\t}\n\n\t\tif !bytes.Equal(k, []byte(\"simple-all\")) {\n\t\t\t// value is non-nil: delete unexpected entry\n\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","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/state/upgrade.go#L273-L309","documentation":"upgradeTaskBucket decodes the task's 0.8 state from the 'simple-all' key using msgpack. If the bytes do not decode into taskRunnerState08, the task's state cannot be migrated; the caller logs a warning and drops the task bucket.","triggerScenarios":"'simple-all' entry contains bytes that fail msgpack decode into taskRunnerState08 (truncated write, different codec handle, binary corruption) during UpgradeAllocs from 0.8 state.","commonSituations":"Disk corruption or unclean shutdown while running Nomad 0.8; restoring a boltdb file from an inconsistent backup; state written by a dev build with a different msgpack schema.","solutions":["Back up the client data_dir, stop nomad, and remove the affected alloc/task state so migration can skip it","Let the client re-run the task from scratch; dropped task state means the task restarts under 0.9+","Verify disk health and that the boltdb file was not restored mid-write","Reproduce with a msgpack dump of the entry and report upstream if the payload looks valid"],"exampleFix":"// before: unreadable legacy state blocks migration of that task\n// after: recover by clearing stale client state\n// nomad stop; mv <data_dir>/client/state.db <data_dir>/client/state.db.bak; nomad start","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Go: accept the drop but alert\nif err := UpgradeAllocs(logger, tx); err != nil && strings.Contains(err.Error(), \"failed to decode task state\") {\n    logger.Warn(\"corrupt legacy task state will be dropped and task restarted\", \"err\", err)\n}","preventionTips":["Enable fsync/durable disks for the client data_dir","Avoid kill -9 on nomad agents","Back up state.db before upgrades","Re-run affected tasks; dropped task state is intentional"],"tags":["nomad","msgpack","decoding","state-migration"],"backgroundTag":"msgpack-decode-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"}