{"record":{"id":"5260b63db080923e","repo":"hashicorp/nomad","slug":"failed-to-create-redacted-snapshot-v","errorCode":null,"errorMessage":"Failed to create redacted snapshot: %v","messagePattern":"Failed to create redacted snapshot: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"helper/raftutil/snapshot.go","lineNumber":96,"sourceCode":"\t\t\trootKey.WrappedKeys = nil\n\t\t}\n\t\tmsg, err := structs.Encode(structs.WrappedRootKeysUpsertRequestType,\n\t\t\t&structs.KeyringUpsertWrappedRootKeyRequest{\n\t\t\t\tWrappedRootKeys: rootKey,\n\t\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Could not re-encode redacted key: %v\", err)\n\t\t}\n\n\t\tfsm.Apply(&raft.Log{\n\t\t\tType: raft.LogCommand,\n\t\t\tData: msg,\n\t\t})\n\t}\n\n\tsnap, err := snapshot.NewFromFSM(hclog.Default(), fsm, meta)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to create redacted snapshot: %v\", err)\n\t}\n\n\tsrcFile.Truncate(0)\n\tsrcFile.Seek(0, 0)\n\n\t_, err = io.Copy(srcFile, snap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to copy snapshot to temporary file: %v\", err)\n\t}\n\n\treturn srcFile.Sync()\n}\n","sourceCodeStart":78,"sourceCodeEnd":109,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/helper/raftutil/snapshot.go#L78-L109","documentation":"After replaying redacted key operations into the in-memory FSM, snapshot.NewFromFSM creates a new snapshot archive from that FSM's state. This error wraps a failure of that snapshot creation, meaning the FSM state or its metadata could not be turned into a valid Raft snapshot.","triggerScenarios":"snapshot.NewFromFSM(logger, fsm, meta) failing — FSM apply operations left the state store in an invalid state, the restored meta is unusable, or the underlying store's snapshotter cannot open a transaction/write its state.","commonSituations":"Corrupt source snapshot metadata carried over into the new snapshot, disk/full or I/O problems affecting temporary sink creation, or a failure earlier in the pipeline (bad key replay) surfacing here.","solutions":["Check the embedded error for the FSM/sink root cause (often a state-store or temp-file issue) and fix that.","Ensure adequate disk space and writable temp directories for snapshot sink creation.","Re-take the source snapshot from a healthy cluster; meta corruption in the original propagates here.","Retry redaction with the same product version as the snapshot."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func ensureDiskSpace(dir string, minBytes uint64) error {\n    var st syscall.Statfs_t\n    if err := syscall.Statfs(dir, &st); err != nil {\n        return err\n    }\n    if uint64(st.Bavail)*uint64(st.Bsize) < minBytes {\n        return fmt.Errorf(\"insufficient free space in %s\", dir)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := raftutil.RedactSnapshot(f); err != nil {\n    if strings.Contains(err.Error(), \"Failed to create redacted snapshot\") {\n        log.Printf(\"snapshot rebuild failed: %v — check disk space and source snapshot meta\", err)\n    }\n}","preventionTips":["Ensure free disk space at least 2x the snapshot size in the temp location.","Verify the source snapshot (including meta) before redaction.","Run in a writable temp directory, not a read-only mount."],"tags":["raft","snapshot","fsm","go"],"backgroundTag":"snapshot-archive-corrupt","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"}