jdx/mise · error
invalid recovery content file
Error message
invalid recovery content file
What it means
read_blob loads a blob either from inline base64 content or from the blobs directory on disk, then sanity-checks the file before reading: it must exist as a regular file (symlink_metadata, so a symlink is rejected) and its length must equal blob.size. If the file is missing, a symlink, a directory, or has a different length than recorded, the recovery aborts because the stored content no longer matches the journal's record.
Solutions
- Restore the missing or truncated blob file in the state_dir blobs directory (e.g. from backup) and retry
- Re-run the checkpoint/snapshot so the blob sidecars are rewritten, then recover again
- Use discard (or discard_except) to drop the unrecoverable operation instead of restoring it
- Verify the state_dir points at the same history directory that recorded the snapshot
Example fix
// before # blob file missing or a symlink recover_path(path, prior)?; // invalid recovery content file // after ls blobs_dir; sha256sum blobs/<sha256> # confirm file exists, is a regular file # if pruned: re-checkpoint then recover # if unrecoverable: discard the operation discard_op(op_id)?;
Defensive patterns
Strategy: validation
Validate before calling
use std::fs::symlink_metadata;
fn blob_file_ok(state_dir: &Path, sha: &str, size: u64) -> bool {
let p = super::journal::blobs_dir_in(state_dir).join(sha);
symlink_metadata(&p).map_or(false, |m| m.is_file() && m.len() == size)
} Try / catch
match recover_path(dest, prior) {
Err(e) if e.to_string().contains("invalid recovery content file") => {
eprintln!("blob sidecar missing/corrupt; re-checkpoint or restore from backup: {e}");
}
other => other?,
} Prevention
- Do not prune the blobs directory while operations are unresolved
- Verify sha and file size before attempting recovery
- Keep state_dir on the same volume/backups as the workspace
When it happens
Trigger: Calling validate_snapshot or restore (via recover_path) where a blob's sha256 field names a file in blobs_dir_in(state_dir) that is absent, has been pruned/GC'd, is a symlink, or whose on-disk length differs from the recorded blob.size.
Common situations: Sidecar blobs deleted by an aggressive cleaner before the operation was resolved; manual cleanup of the history/state directory; truncated writes after a crash; blobs moved to another machine with incomplete state_dir sync.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- a parent directory is now a symlink; left untouched
- app Info.plist must be a regular file
- app target is outside an allowed Applications directory
- artifact directory was initialized
- binary target is not an owned Caskroom symlink
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/d903d83bc1e93409.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/history/recovery.rs:137
}
fn validate_blob_id(hash: &str) -> Result<()> {
if hash.len() != 64 || !hash.bytes().all(|b| b.is_ascii_hexdigit()) {
bail!("invalid recovery content identifier");
}
Ok(())
}
pub(super) fn read_blob(state_dir: &Path, blob: &Blob) -> Result<Vec<u8>> {
use base64::Engine;
validate_blob_id(&blob.sha256)?;
let bytes = match &blob.inline {
Some(inline) => base64::engine::general_purpose::STANDARD.decode(inline)?,
None => {
let path = super::journal::blobs_dir_in(state_dir).join(&blob.sha256);
let metadata = std::fs::symlink_metadata(&path)?;
if !metadata.is_file() || metadata.len() != blob.size {
bail!("invalid recovery content file");
}
std::fs::read(path)?
}
};
if bytes.len() as u64 != blob.size || hex::encode(sha2::Sha256::digest(&bytes)) != blob.sha256 {
bail!("recovery content failed verification");
}
Ok(bytes)
}
fn validate_snapshot(state_dir: &Path, snapshot: &PathSnapshot) -> Result<()> {
match snapshot {
PathSnapshot::File { content, .. } => {
read_blob(state_dir, content)?;
}
PathSnapshot::Dir {
files, links, dirs, ..
} => {View on GitHub (pinned to 533346cc37)