jdx/mise · error
cannot link {} to its own install path
Error message
cannot link {} to its own install path What it means
`mise link` refuses when the source path and the destination (installs/<tool>/<version_pathname>) are the same file (file::same_file, with an exception when the destination is already a correct symlink to it). Creating that link would point a directory at itself, producing a broken/infinite-resolution install entry.
Source
Thrown at src/cli/link.rs:72
"mise link only supports concrete versions and refs, not {}",
tvr.version()
);
}
ToolVersion::new(tvr.clone(), version.clone()).tv_pathname()
}
ToolRequest::Ref { .. } => ToolVersion::new(tvr.clone(), tvr.version()).tv_pathname(),
_ => unreachable!(),
};
let path = self.path.absolutize()?;
if !path.exists() {
warn!(
"Target path {} does not exist",
style(path.to_string_lossy()).cyan().for_stderr()
);
}
let target = self.tool.ba.installs_path.join(&version_pathname);
if !file::is_symlink_to(&target, &path) && file::same_file(&path, &target) {
bail!("cannot link {} to its own install path", self.tool.style());
}
{
let _state_lock =
install_state::lock_tool_version(&self.tool.ba.short, &version_pathname)?;
if !file::is_symlink_to(&target, &path) {
if target.exists() {
if self.force {
remove_all(&target)?;
} else {
return Err(eyre!(
"Tool version {} already exists, use {} to overwrite",
self.tool.style(),
style("--force").yellow().for_stderr()
));
}
}
file::create_dir_all(target.parent().unwrap())?;
make_symlink(&path, &target)?;View on GitHub (pinned to 9dcfcaa0dc)
Solutions
- Link from a copy or the original location outside mise's installs tree: `cp -r ~/.tools/node-22 ~/.local/share/mise/installs/node/22.17.1-src` then link that
- If the version is already correctly installed at the target, no link is needed — `mise use node@22.17.1` directly
- Remove the half-finished target directory first (`mise uninstall node@22.17.1` or rm the path), then link from the real source
Example fix
# before mise link node@22.17.1 ~/.local/share/mise/installs/node/22.17.1 # after mise link node@22.17.1 /opt/node-v22.17.1
Defensive patterns
Strategy: validation
Validate before calling
#!/usr/bin/env bash
src=$(readlink -f "$1")
dst=$(readlink -f "${MISE_DATA_DIR:-$HOME/.local/share/mise}/installs/$tool/$version_path")
[[ "$src" == "$dst" ]] && { echo "refusing: source equals target install path" >&2; exit 2; }
mise link "$tool@$version_path" "$1" Try / catch
mise link "$tool@$v" "$src" 2>err.log || { grep -q 'its own install path' err.log && echo "already installed there; nothing to link" >&2; } Prevention
- Keep custom tool installs outside mise's installs directory before linking them
- Verify with realpath that source and destination differ
When it happens
Trigger: Linking a tool that already lives inside mise's installs tree for the same tool+version, e.g. `mise link node@22.17.1 ~/.local/share/mise/installs/node/22.17.1`; linking after a partial previous link left the real directory at the target path.
Common situations: Trying to 'repair' an existing mise-managed install by linking to itself; moving installs around and picking the old canonical path as the link source.
Related errors
- mise link only supports concrete versions and refs, not {}
- must provide a version for {}
- install from exe
- No config file found in current directory
- cannot write task stub because {} is a symbolic link
AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17).
Data as JSON: /api/errors/a6776e88b17a69f1.
Report an issue: GitHub.