hashicorp/nomad · error

Failed to create redacted snapshot: %v

Error message

Failed to create redacted snapshot: %v

What it means

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.

Source

Thrown at helper/raftutil/snapshot.go:96

			rootKey.WrappedKeys = nil
		}
		msg, err := structs.Encode(structs.WrappedRootKeysUpsertRequestType,
			&structs.KeyringUpsertWrappedRootKeyRequest{
				WrappedRootKeys: rootKey,
			})
		if err != nil {
			return fmt.Errorf("Could not re-encode redacted key: %v", err)
		}

		fsm.Apply(&raft.Log{
			Type: raft.LogCommand,
			Data: msg,
		})
	}

	snap, err := snapshot.NewFromFSM(hclog.Default(), fsm, meta)
	if err != nil {
		return fmt.Errorf("Failed to create redacted snapshot: %v", err)
	}

	srcFile.Truncate(0)
	srcFile.Seek(0, 0)

	_, err = io.Copy(srcFile, snap)
	if err != nil {
		return fmt.Errorf("Failed to copy snapshot to temporary file: %v", err)
	}

	return srcFile.Sync()
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Check the embedded error for the FSM/sink root cause (often a state-store or temp-file issue) and fix that.
  2. Ensure adequate disk space and writable temp directories for snapshot sink creation.
  3. Re-take the source snapshot from a healthy cluster; meta corruption in the original propagates here.
  4. Retry redaction with the same product version as the snapshot.
Defensive patterns

Strategy: validation

Validate before calling

func ensureDiskSpace(dir string, minBytes uint64) error {
    var st syscall.Statfs_t
    if err := syscall.Statfs(dir, &st); err != nil {
        return err
    }
    if uint64(st.Bavail)*uint64(st.Bsize) < minBytes {
        return fmt.Errorf("insufficient free space in %s", dir)
    }
    return nil
}

Try / catch

if err := raftutil.RedactSnapshot(f); err != nil {
    if strings.Contains(err.Error(), "Failed to create redacted snapshot") {
        log.Printf("snapshot rebuild failed: %v — check disk space and source snapshot meta", err)
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/5260b63db080923e. Report an issue: GitHub.