jdx/mise · error
target is not the managed directory, use --force to remove…
Error message
target is not the managed directory, use --force to remove it
What it means
Unapply planning for directory `symlink-each` entries: the target is expected to be a directory whose children are managed symlinks, but the target is itself a symlink or a non-directory file. Mise cannot enumerate owned children, so without `--force` it refuses to remove the object.
Solutions
- Inspect the target (`ls -la <target>`); if it is a link you own, remove it manually and re-run.
- Align the config `mode` with what was actually applied (back to symlink), unapply, then switch modes.
- Use `mise dot unapply --force` once certain the object is disposable.
Example fix
// before: target ~/.config/nvim is a symlink but entry uses mode="symlink-each" # temporarily set mode = "symlink" in [dotfiles]."~/.config/nvim" mise dot unapply # then restore mode = "symlink-each"
Defensive patterns
Strategy: validation
Validate before calling
[ -d ~/.config/nvim ] && [ ! -L ~/.config/nvim ] || echo 'symlink-each target must be a real directory'
Prevention
- Change `mode` in config only after unapplying the entry with its current mode.
- Don't replace managed target directories with symlinks manually.
- Audit targets with `ls -la` before switching between symlink and symlink-each.
When it happens
Trigger: `mise dot unapply` on a `mode = "symlink-each"` entry whose target path is a symlink or regular file instead of a directory (e.g. the user applied the entry earlier with `mode = "symlink"`, then changed the config to symlink-each).
Common situations: Config mode migrated between symlink and symlink-each after applying; user replaced the target directory with a symlink to elsewhere; another tool took over the path.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- files: cannot unapply these entries
- files: cannot unapply these entries:\n
- target is not the managed symlink, use --force to remove it
- target symlink points to
- a glob is required
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/27a113f1e53e0415.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/files.rs:2767
"target symlink points to {}, use --force to remove it",
dest.display_user()
);
}
} else if req.target.exists() {
if opts.force {
paths.insert(req.target.clone(), ());
} else {
bail!("target is not the managed symlink, use --force to remove it");
}
}
}
FileMode::SymlinkEach if !cfg!(windows) => {
clear_symlink_each_state = symlink_each_state_path(req).exists();
if req.target.is_symlink() || (req.target.exists() && !req.target.is_dir()) {
if opts.force {
paths.insert(req.target.clone(), ());
} else {
bail!("target is not the managed directory, use --force to remove it");
}
} else if req.target.is_dir() {
for path in owned_links(req)? {
paths.insert(path, ());
}
cleanup_empty_dirs = true;
}
}
FileMode::Copy | FileMode::SymlinkEach if req.source.is_dir() => {
if req.target.is_symlink() || (req.target.exists() && !req.target.is_dir()) {
if opts.force {
paths.insert(req.target.clone(), ());
} else {
bail!("target is not the managed directory, use --force to remove it");
}
} else if req.target.is_dir() {
for (source, target) in walk_source_files(req)? {
plan_regular_file(&source, &target, opts.force, &mut paths)?;View on GitHub (pinned to 533346cc37)