jdx/mise · error
rename_exe: cannot rename
Error message
rename_exe: cannot rename '{}' to '{}': target already exists. Check for duplicate or overlapping rename_exe mappings. What it means
During a rename_exe operation, mise refuses to overwrite an existing target file. finish_rename checks target_path.exists() before renaming, so overlapping renames cannot silently clobber binaries. The error points at duplicate or conflicting rename_exe mappings in the tool config.
Solutions
- Review rename_exe mappings for duplicates and make each target unique
- Delete the stale target file from the install directory and retry the install
- If the target is a legitimately shipped binary, remove the redundant rename entry
Example fix
# before [[bin]] rename_exe = "tool" [[bin]] rename_exe = "tool" # duplicate target # after [[bin]] rename_exe = "tool-a" [[bin]] rename_exe = "tool-b"
Defensive patterns
Strategy: validation
Validate before calling
import os
# preflight before rename/install
targets = [m['rename_exe'] for m in mappings]
assert len(targets) == len(set(targets)), 'duplicate rename_exe targets'
clashes = [t for t in targets if os.path.exists(os.path.join(install_dir, t))]
assert not clashes, f'targets already exist: {clashes}' Try / catch
try:
install()
except RuntimeError as e:
if 'target already exists' in str(e):
cleanup_stale_files(install_dir)
install()
else:
raise Prevention
- Make rename_exe targets unique
- Clean install dirs between versions
- Detect overlapping mappings at config load
When it happens
Trigger: apply_rename_exe encounters a destination path that already exists on disk and is not the source itself — typically two rename_exe entries (or a rename plus a real file) mapping different sources to the same target name.
Common situations: Two tools in the same package shipping a binary with the same name; a leftover file from a previous install plus a new rename mapping; duplicated config entries.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
- directory ' ' cannot be present while managed parent ' ' is…
- failed rename: ->
- file ' ' cannot be present while managed parent ' ' is…
- a parent directory is now a symlink; left untouched
- app Info.plist must be a regular file
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/b47fcfe030d67cd0.
Report an issue: GitHub.
Appendix: source
Thrown at src/backend/static_helpers.rs:1234
}
/// Renames `path` (named `file_name`) to `target` within `dir`, preserving any
/// required extension and ensuring the result is executable. A collision on the
/// target (two mappings pointing at the same name, or the archive already
/// containing that name) is unsatisfiable, so it fails the install loudly rather
/// than silently dropping a binary and reporting success.
fn finish_rename(dir: &Path, path: &Path, file_name: &str, target: &str) -> eyre::Result<()> {
let target_path = keep_required_extensions(dir, file_name, target, dir.join(target));
// Ensure the binary is executable whether or not we move it: ZIP archives drop
// the exec bit, and the file may already carry the desired name.
if !file::is_executable(path) {
file::make_executable(path)?;
}
if path == target_path {
return Ok(());
}
if target_path.exists() {
bail!(
"rename_exe: cannot rename '{}' to '{}': target already exists. \
Check for duplicate or overlapping rename_exe mappings.",
path.display(),
target_path.display()
);
}
file::rename(path, &target_path)?;
debug!("Renamed {} to {}", path.display(), target_path.display());
Ok(())
}
/// Helper function to rename executable inside a macOS .app bundle
fn rename_executable_in_app_bundle(
macos_dir: &Path,
target_path: &Path,
tool_name: Option<&str>,
) -> eyre::Result<bool> {
// Find the first executable in the Contents/MacOS directoryView on GitHub (pinned to 533346cc37)