jdx/mise · error
target is not the managed symlink, use --force to remove it
Error message
target is not the managed symlink, use --force to remove it
What it means
Unapply planning for symlink-mode entries: the target exists but is NOT a symlink (a regular file or other object sits where mise would have placed its symlink). Mise cannot prove the target is its own, so it refuses to delete it without `--force`.
Solutions
- Verify the target's content; if it is your own file, remove it manually and re-run unapply.
- Back it up (`mv <target> <target>.bak`) then re-run `mise dot unapply`.
- Use `mise dot unapply --force` if you accept deleting the non-managed file.
Example fix
// before: ~/.gitconfig is a regular file but entry is mode=symlink mv ~/.gitconfig ~/.gitconfig.bak mise dot unapply # succeeds, then optionally restore/apply
Defensive patterns
Strategy: validation
Validate before calling
[ -L ~/.gitconfig ] || echo 'target is not a symlink; unapply will need --force or manual removal'
Prevention
- Treat managed symlink targets as owned by mise; don't materialize them into real files.
- When migrating from another dotfile manager, clean up its artifacts first.
- Keep entry `mode` consistent with how the entry was originally applied.
When it happens
Trigger: `mise dot unapply` on a symlink entry where the target path was replaced by a regular file — e.g. the user copied the dotfile content into a real file, or another tool wrote the file — while `--force` was not given.
Common situations: A dotfile manager migration (e.g. from stow or chezmoi) replaced symlinks with real files; user ran an editor/tool that materialized the file; `mode` was changed from copy to symlink in config after applying.
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
- target symlink points to
- [dotfiles]." ": mode symlink-each requires a directory…
- files: cannot unapply these entries:\n
- mode symlink-each requires the source to be a directory
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/c24905f7b272248a.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/files.rs:2757
FileMode::Symlink
if !(cfg!(windows) && req.source.is_file() && !req.target.is_symlink()) =>
{
if req.target.is_symlink() {
let dest = std::fs::read_link(&req.target)?;
if opts.force || dest == req.source || points_at_same_file(&req.target, &req.source)
{
paths.insert(req.target.clone(), ());
} else {
bail!(
"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;
}
}View on GitHub (pinned to 533346cc37)