jdx/mise · error
directory contents cannot be verified safely; left untouched
Error message
directory contents cannot be verified safely; left untouched
What it means
When the recorded evidence for a directory is a non-empty Dir state without a verified identity (or the prior snapshot is not a matching Directory snapshot), mise cannot prove what the directory's contents should be. Rather than replace a populated directory on entry-count evidence alone, it bails and leaves the directory untouched.
Solutions
- Manually inspect the directory and its intended contents; resolve the difference by hand (copy entries from the recovery/temp store).
- If the current directory contents are acceptable, accept them with `mise dot recover <operation> --keep-current`.
- Recover individual files inside the directory one level deeper where snapshots are file-granular, then remove the now-empty/verified directory state.
- If the store is legacy/corrupt, rebuild the enrollment/recovery state after backing up the live directory.
Example fix
// before: directory can't be verified $ mise dot recover # directory contents cannot be verified safely // after ls ~/.config/somedir/ # inspect manually mise dot recover <op> --keep-current # accept current contents
Defensive patterns
Strategy: try-catch
Validate before calling
export function canVerifyDirectory(after: DirState, prior: Snapshot): boolean {
// non-empty dirs need a verified identity or a matching Directory snapshot
return after.entries === 0 || after.identity != null || prior.kind === 'directory';
} Type guard
function hasVerifiedIdentity(s: DirState): boolean {
return s.identity != null;
} Try / catch
try {
await dotRecover(op);
} catch (e) {
if (/directory contents cannot be verified/.test(String(e))) {
manuallyReconcile(dirPath); // copy from recovery store as needed
await dotRecover(op, { keepCurrent: true });
} else throw e;
} Prevention
- Prefer file-level enrollment over whole-directory operations
- Back up populated directories before recovery
- Keep recovery store format current so identity data is recorded
When it happens
Trigger: recover_path reaches the directory verification branch with `after` being PathState::Dir with entries != 0, but there is no verified identity (`identity: None`) and the prior snapshot is not a matching PathSnapshot::Directory — so contents cannot be validated.
Common situations: Recovering an interrupted directory operation (move/replace) where the journal lacks content hashes/identities for directory entries; a crash during a directory write left partial entries; the recovery store predates identity-recording so legacy entries lack the needed proof.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- cannot verify ; use --force to remove it
- changed after the operation; left untouched
- changed while preparing recovery; left untouched
- differs from its managed source; use --force to remove it
- interrupted file recovery needs attention; temporary…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/72c0fb5302d21a63.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/history/recovery.rs:100
let Some(after) = after else {
bail!("write completion was not recorded; inspect the live file before retrying recovery");
};
if PathState::observe(path) != *after {
bail!("changed after the operation; left untouched");
}
// Entry count alone cannot establish a directory's identity. Never
// replace a populated directory on that evidence.
if matches!(after, PathState::Dir { entries, .. } if *entries != 0)
&& !(matches!(prior, PathSnapshot::Directory { .. })
&& matches!(
after,
PathState::Dir {
identity: Some(_),
..
}
))
{
bail!("directory contents cannot be verified safely; left untouched");
}
validate_snapshot(state_dir, prior)?;
if PathState::observe(path) != *after {
bail!("changed while preparing recovery; left untouched");
}
restore(state_dir, path, prior)
}
fn validate_destination(path: &Path) -> Result<()> {
if !path.is_absolute() || path.components().any(|c| matches!(c, Component::ParentDir)) {
bail!("invalid recovery destination");
}
for parent in path.ancestors().skip(1) {
if std::fs::symlink_metadata(parent).is_ok_and(|meta| meta.is_symlink()) {
bail!("a parent directory is now a symlink; left untouched");
}
}
Ok(())View on GitHub (pinned to 533346cc37)