jdx/mise · error

write completion was not recorded; inspect the live file bef

Error message

write completion was not recorded; inspect the live file before retrying recovery

What it means

recover_path first checks whether the live file already matches the recorded prior snapshot (nothing to do). If recovery must proceed but the operation's 'after' state was never recorded, it cannot know the intended final state and bails, telling the user to inspect the live file rather than guessing.

Source

Thrown at src/system/history/recovery.rs:83

    state_dir: &Path,
    path: &Path,
    prior: &PathSnapshot,
    after: Option<&PathState>,
) -> Result<()> {
    validate_destination(path)?;
    let comparison = tempfile::tempdir()?;
    let depth = if matches!(prior, PathSnapshot::Directory { .. }) {
        Capture::Shallow
    } else {
        Capture::Full
    };
    // Comparing must not leave copies of concurrent user edits in the store.
    let current = PathSnapshot::capture_with(comparison.path(), path, depth);
    if !matches!(prior, PathSnapshot::Unrecorded { .. }) && &current == prior {
        return Ok(());
    }
    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");
    }

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Manually inspect the live file at the reported path and confirm it is correct.
  2. If current contents are correct, accept them with `recover <operation> --keep-current`.
  3. If contents are wrong, restore the intended content manually, then retry recovery.
  4. Re-run bootstrap enrollment to rebuild the recovery/checkpoint state.

Example fix

// before: blind retry
$ mise bootstrap dotfiles recover
// after: verify the live file first, then accept it
$ cat ~/.zshrc  # inspect
$ mise bootstrap dotfiles recover <operation> --keep-current
Defensive patterns

Strategy: try-catch

Try / catch

if let Err(e) = recover_entries(state_dir, plan) {
    if e.to_string().contains("write completion was not recorded") {
        eprintln!("inspect the listed live file, then rerun with --keep-current");
    }
}

Prevention

When it happens

Trigger: recover_path invoked via recover_entries with after == None for the path, and the current file differs from the prior snapshot — i.e. the original operation crashed before recording its completion state.

Common situations: A hard kill/power loss during a dotfile write left no completion checkpoint; recovery data written partially; retrying recovery of an operation that never got far enough to snapshot its result.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/96d089719ace29cd. Report an issue: GitHub.