jdx/mise · error

differs from its managed source; use --force to remove it

Error message

{} differs from its managed source; use --force to remove it

What it means

Final content-verification step of unapply planning: the target is removed only if `force` is set or the target is a plain file whose bytes equal the expected managed content. Otherwise the library bails, stating the target differs from its managed source, to avoid deleting files the user modified.

Solutions

  1. Re-run with `--force` to remove the modified target
  2. Reset the target to the managed content (re-apply first) and then unapply
  3. Preserve local changes: copy the target aside before using --force

Example fix

// before
$ mise files unapply
error: /home/u/.gitconfig differs from its managed source; use --force to remove it

// after
$ mise files unapply --force
Defensive patterns

Strategy: validation

Validate before calling

if fs::read(target)? != expected_content {
    warn("target drifted from managed content; unapply will require --force");
}

Prevention

When it happens

Trigger: Unapply where the target exists but `file::read(target) != expected` and `force` is false — e.g. the target was edited after apply, or has drifted due to another tool rewriting it.

Common situations: A user edits an applied dotfile, or an installer/tool rewrites the file, then `mise files unapply` refuses to remove the drifted file.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/f5039bb8284bf9ff. Report an issue: GitHub.

Appendix: source

Thrown at src/system/files.rs:2915

    } else {
        bail!(
            "cannot verify {}; use --force to remove it",
            target.display_user()
        )
    }
}

fn plan_expected_content(
    expected: &[u8],
    target: &Path,
    force: bool,
    paths: &mut IndexMap<PathBuf, ()>,
) -> Result<()> {
    if force || (target.is_file() && !target.is_symlink() && file::read(target)? == expected) {
        paths.insert(target.to_path_buf(), ());
        Ok(())
    } else {
        bail!(
            "{} differs from its managed source; use --force to remove it",
            target.display_user()
        )
    }
}

/// All symlinks under a symlink-each target that point exactly where this
/// entry maps that relative path. Unlike stale-link pruning this includes
/// both current and deleted source files because unapply removes the entry's
/// complete observable footprint.
fn legacy_owned_links(req: &FileRequest) -> Result<Vec<PathBuf>> {
    if !req.target.is_dir() || req.target.is_symlink() {
        return Ok(vec![]);
    }
    let mut out = vec![];
    for entry in walkdir::WalkDir::new(&req.target).sort_by_file_name() {
        let entry = match entry {
            Ok(entry) => entry,

View on GitHub (pinned to 533346cc37)