jdx/mise · error

target differs from the managed content, use --force to…

Error message

target differs from the managed content, use --force to remove it

What it means

When unapplying a `file` (copy) entry whose source is missing, mise can only safely remove the target if the target still matches the inline managed content byte-for-byte. If the target is not a symlink and its contents differ from the expected content, the library refuses to delete a file it cannot prove it owns and asks for `--force`.

Solutions

  1. Re-run with `--force` to remove the modified target anyway
  2. Restore the source file so mise can compare against it again
  3. If the local edits matter, save a copy of the target before unapplying with --force

Example fix

// before
$ mise files unapply
error: target differs from the managed content, use --force to remove it

// after — after saving any local edits elsewhere
$ mise files unapply --force
Defensive patterns

Strategy: validation

Validate before calling

if !source.exists() && target.is_file()
   && fs::read_to_string(target)? != inline_content {
   warn("target modified locally; unapply will need --force");
}

Prevention

When it happens

Trigger: Unapply planning where `req.source` does not exist, the target exists as a regular file, and `file::read(target) != req.content` — i.e. the user edited the applied copy after installation, or the inline content in config changed.

Common situations: A user hand-edited an applied dotfile, then removed the source from their dotfiles repo and tried to unapply; or the config's inline content was updated but never re-applied before removing the source.

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/1ad82e33ce786976. Report an issue: GitHub.

Appendix: source

Thrown at src/system/files.rs:2862

    } else {
        Ok(Some(UnapplyPlan {
            req,
            paths: paths.into_keys().collect(),
            cleanup_empty_dirs,
            conditional,
            clear_symlink_each_state,
        }))
    }
}

fn plan_inline_file(req: &FileRequest, paths: &mut IndexMap<PathBuf, ()>) -> Result<()> {
    if !req.target.is_symlink()
        && req.target.is_file()
        && file::read(&req.target)? == req.content.as_deref().expect("inline content").as_bytes()
    {
        paths.insert(req.target.clone(), ());
    } else if req.target.exists() || req.target.is_symlink() {
        bail!("target differs from the managed content, use --force to remove it");
    }
    Ok(())
}

fn plan_single_file(
    req: &FileRequest,
    opts: &UnapplyOpts,
    paths: &mut IndexMap<PathBuf, ()>,
) -> Result<()> {
    if !req.source.exists() && req.target.exists() && !opts.force {
        bail!("source is missing; use --force to remove the target");
    }
    if opts.force && (req.target.exists() || req.target.is_symlink()) {
        paths.insert(req.target.clone(), ());
    } else if req.source.exists() {
        plan_regular_file(&req.source, &req.target, false, paths)?;
    }
    Ok(())

View on GitHub (pinned to 533346cc37)