jdx/mise · error
source is missing; use --force to remove the target
Error message
source is missing; use --force to remove the target
What it means
During unapply planning for a template-mode file, the managed source no longer exists, so mise cannot re-render or verify the target content. Removing the target would destroy a file whose managed origin is gone, so the library requires the user to opt in with `--force`, which instructs it to remove the target unconditionally.
Solutions
- Re-run with `--force` (e.g. `mise files unapply --force`) to explicitly allow removing the target
- Restore the source template from git and re-run unapply without --force
- Delete the stale target file manually and remove the config entry
Example fix
// before $ mise files unapply error: source is missing; use --force to remove the target // after $ mise files unapply --force
Defensive patterns
Strategy: validation
Validate before calling
if !source.exists() && target.exists() {
// require explicit user opt-in before removing
require_flag("--force");
} Try / catch
// CLI wrapper
if (err.message.includes('source is missing')) {
prompt(`Source gone; remove ${target} anyway? rerun with --force`);
} Prevention
- Run `mise files status` before unapply to spot missing sources
- Keep source templates in version control
- Never delete dotfile sources without first unapplying
When it happens
Trigger: Running `mise files unapply` on a template file entry where `req.source` does not exist, `opts.force` is false, and the target still exists (the earlier `!req.target.exists()` early-return did not fire).
Common situations: The dotfiles template was deleted from the repo after being applied; a user switches branches removing the template; the source path moved, then the user tries to tear down the applied target file.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- cannot verify ; use --force to remove it
- differs from its managed source; use --force to remove it
- directory contents cannot be verified safely; left untouched
- source directory is missing, so managed children cannot be…
- target differs from the managed content, use --force to…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/e66897591b2e5ef6.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/files.rs:2834
plan_single_file(req, opts, &mut paths)?;
}
FileMode::SymlinkEach => {
bail!("mode symlink-each requires the source to be a directory");
}
FileMode::Template => {
if !req.target.exists() && !req.target.is_symlink() {
return Ok(None);
}
if opts.force {
paths.insert(req.target.clone(), ());
} else if opts.dry_run {
// Rendering may execute commands. Keep dry-run inert, matching
// apply/status policy, and describe the removal as conditional.
paths.insert(req.target.clone(), ());
conditional = true;
} else {
if !req.source.exists() {
bail!("source is missing; use --force to remove the target");
}
// Rendering may execute user-authored commands. Defer it until
// after the complete unapply plan has been confirmed.
conditional = true;
}
}
}
if paths.is_empty() && !cleanup_empty_dirs && !conditional && !clear_symlink_each_state {
Ok(None)
} else {
Ok(Some(UnapplyPlan {
req,
paths: paths.into_keys().collect(),
cleanup_empty_dirs,
conditional,
clear_symlink_each_state,
}))
}View on GitHub (pinned to 533346cc37)