Describe the bug
If there are some older tool versions installed (which also match version requirement in .mise.toml) and we do mise rm <tool@current_version> then we get broken $PATH and mise i is unable to fix this issue.
To fix this situation we need to do something unusual: either remove all versions of the tool and then mise i will fix it, or install just removed "current_version" back, or leave project's directory and enter again.
To Reproduce
Start clean, and ensure mise i won't add new tools to PATH, just in case (so far so good):
$ mkdir mise-rm-path-bug
$ cd mise-rm-path-bug
$ dust --version
zsh: command not found: dust
$ mise ls dust
Tool Version Config Source Requested
$ mise i dust@0.8.1
mise Installed binary into /home/powerman/.local/share/mise/installs/dust/0.8.1/bin/dust
mise ubi:bootandy/dust@0.8.1 ✓ installed
$ mise i dust@0.8.3
mise Installed binary into /home/powerman/.local/share/mise/installs/dust/0.8.3/bin/dust
mise ubi:bootandy/dust@0.8.3 ✓ installed
$ mise ls dust
Tool Version Config Source Requested
dust 0.8.1
dust 0.8.3
$ dust --version
zsh: command not found: dust
Now, start using it and then upgrade, to ensure mise i will update PATH (so far so good too):
$ mise bin-paths | grep dust
$ printf "%s\n" $path | grep dust
$ mise use dust@0.8
mise ~/tmp/mise-rm-path-bug/.mise.toml tools: ubi:bootandy/dust@0.8.3
$ dust --version
Dust 0.8.3
$ mise i dust@0.8.2
mise Installed binary into /home/powerman/.local/share/mise/installs/dust/0.8.2/bin/dust
mise ubi:bootandy/dust@0.8.2 ✓ installed
$ dust --version
Dust 0.8.3
$ mise i dust@0.8.5
mise Installed binary into /home/powerman/.local/share/mise/installs/dust/0.8.5/bin/dust
mise ubi:bootandy/dust@0.8.5 ✓ installed
$ dust --version
Dust 0.8.5
Then, remove currently used version and get broken PATH:
$ mise ls dust
Tool Version Config Source Requested
dust 0.8.1
dust 0.8.2
dust 0.8.3
dust 0.8.5 (outdated) ~/tmp/mise-rm-path-bug/.mise.toml 0.8
$ mise bin-paths | grep dust
/home/powerman/.local/share/mise/installs/dust/0.8.5/bin
$ printf "%s\n" $path | grep dust
/home/powerman/.local/share/mise/installs/dust/0.8.5/bin
$ mise rm dust@0.8.5
mise ubi:bootandy/dust@0.8.5 ✓ uninstalled
$ mise exec -- dust --version
Dust 0.8.3
$ dust --version
zsh: command not found: dust
$ mise ls dust
Tool Version Config Source Requested
dust 0.8.1
dust 0.8.2
dust 0.8.3 (outdated) ~/tmp/mise-rm-path-bug/.mise.toml 0.8
$ mise bin-paths | grep dust
/home/powerman/.local/share/mise/installs/dust/0.8.3/bin
$ printf "%s\n" $path | grep dust
/home/powerman/.local/share/mise/installs/dust/0.8.5/bin
The last line (above) demonstrate the issue: PATH still contain uninstalled/non-existing version, while Mise tools like bin-paths and ls thinks PATH contains another, existing version. As result of this it's even impossible to "fix" this in usual way:
$ cat .mise.toml
[tools]
dust = "0.8"
$ mise i
mise all runtimes are installed
$ dust --version
zsh: command not found: dust
Expected behavior
If mise install updates $PATH when installing newer version which matches requirement in config then mise uninstall should do the same when uninstalling currently used version. Or, more precisely, mise hook-env should handle this case.
Describe the bug If there are some older tool versions installed (which also match version requirement in
.mise.toml
) and we domise rm <tool@current_version>
then we get broken$PATH
andmise i
is unable to fix this issue.To fix this situation we need to do something unusual: either remove all versions of the tool and then
mise i
will fix it, or install just removed "current_version" back, or leave project's directory and enter again.To Reproduce Start clean, and ensure
mise i
won't add new tools to PATH, just in case (so far so good):Now, start using it and then upgrade, to ensure
mise i
will update PATH (so far so good too):Then, remove currently used version and get broken PATH:
The last line (above) demonstrate the issue: PATH still contain uninstalled/non-existing version, while Mise tools like
bin-paths
andls
thinks PATH contains another, existing version. As result of this it's even impossible to "fix" this in usual way:Expected behavior If
mise install
updates$PATH
when installing newer version which matches requirement in config thenmise uninstall
should do the same when uninstalling currently used version. Or, more precisely,mise hook-env
should handle this case.mise doctor
output