jdx/mise · error
target differs from the managed content, use --force to remo
Error message
target differs from the managed content, use --force to remove it
What it means
At src/system/files.rs:2614 (inline-content planning in plan_expected_content), mise will remove a target without --force only when it is a regular file exactly matching the managed inline content. If the target exists (or is a symlink) but differs from that content, mise bails to avoid deleting user-modified data.
Source
Thrown at src/system/files.rs:2614
} 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 afd2eddd3a)
Solutions
- Rerun unapply with --force to remove the modified target anyway
- Back up the differing file, then rerun with --force
- Compare contents (diff/cmp) to confirm the changes are disposable before forcing
- Update the inline content in mise.toml if you intend to keep applying modified content
Example fix
# before mise bootstrap dotfiles unapply # error: target differs from the managed content, use --force to remove it # after (after backing up) cp ~/.gitignore ~/.gitignore.bak && mise bootstrap dotfiles unapply --force
Defensive patterns
Strategy: validation
Validate before calling
if (fs.existsSync(entry.target) &&
fs.readFileSync(entry.target).toString() !== entry.content) {
console.warn(`${entry.target} was modified locally; unapply will need --force`);
} Type guard
function matchesManagedContent(entry) {
try { return fs.readFileSync(entry.target).toString() === entry.content; }
catch { return false; }
} Try / catch
try {
await unapply(plan);
} catch (e) {
if (String(e).includes('target differs from the managed content')) {
backup(entry.target);
await unapply({ ...plan, force: true });
} else throw e;
} Prevention
- Avoid editing files applied from inline content directly
- Diff managed targets against their content before unapplying
- Keep inline content in mise.toml updated to include intentional changes
When it happens
Trigger: `mise bootstrap dotfiles unapply` on an entry with inline content where the target exists but is a symlink, or a file whose bytes differ from req.content, and opts.force is false.
Common situations: The user edited the managed file locally; another tool rewrote it; or a symlink was placed at the target pointing elsewhere after the entry was applied.
Related errors
- {} differs from its managed source; use --force to remove it
- source is missing; use --force to remove the target
- cannot verify {}; use --force to remove it
- failed rename: {} -> {}: {err}
- {err} dotfiles: rollback failed: {rollback_err}
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/1ad82e33ce786976.
Report an issue: GitHub.