jdx/mise · error

invalid version: {}

Error message

invalid version: {}

What it means

`mise latest TOOL@VERSION` only accepts request forms it can turn into a prefix: a concrete version (node@20.1.0 or prefix digits like node@20), a `sub-N:<base>` channel, or no version at all. Other ToolRequest variants — `path:` requests, `system`, and prefix patterns like `20.x` — hit the catch-all arm and are rejected as 'invalid version' before any backend lookup.

Source

Thrown at src/cli/latest.rs:59

}

impl Latest {
    pub async fn run(self) -> Result<()> {
        let before_date = self.get_before_date()?;
        let config = Config::get().await?;
        let Self {
            tool,
            asdf_version,
            installed,
            minimum_release_age: _,
        } = self;
        let prefix = match &tool.tvr {
            None => asdf_version,
            Some(ToolRequest::Version { version, .. }) => Some(version.clone()),
            // `sub-N:<base>` resolves its base against the backend, so it is handled
            // below once the backend (and its plugin) is ready.
            Some(ToolRequest::Sub { .. }) => None,
            _ => bail!("invalid version: {}", tool.style()),
        };

        let mut backend = tool.ba.backend()?;
        let mpr = MultiProgressReport::get();
        if let Some(plugin) = backend.plugin() {
            plugin.ensure_installed(&config, &mpr, false, false).await?;
            backend = tool.ba.backend()?;
        }
        let prefix = match &tool.tvr {
            Some(ToolRequest::Sub {
                sub, orig_version, ..
            }) => Some(
                resolve_sub_base(&config, &backend, sub, orig_version, before_date, false).await?,
            ),
            _ => match prefix {
                Some(v) => Some(config.resolve_alias(&backend, &v).await?),
                None => None,
            },

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Use a plain version or prefix: `mise latest node` or `mise latest node@20`
  2. For sub-channels use the supported form: `mise latest node@sub-1:22`
  3. Do not forward `path:`/`system`/`ref:`/`N.x` specifiers from other config into `mise latest` — filter them out in your script first

Example fix

# before
mise latest node@path:~/.local/node
# after
mise latest node@20
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
req=$1
case "$req" in
  *:path:*|path:*|system|ref:*|*.x|*.X) echo "unsupported request form for mise latest: $req" >&2; exit 2 ;;
esac
mise latest "$req"

Try / catch

mise latest "$tool@$ver" 2>err.log || { grep -q 'invalid version' err.log && echo "pass a plain version or prefix, e.g. $tool@20" >&2; exit 2; }

Prevention

When it happens

Trigger: `mise latest node@path:/usr/local` , `mise latest node@system`, or `mise latest node@20.x`; also `mise latest node@ref:main` since Ref is not an accepted variant here.

Common situations: Piping a tool version string from config (which allows path:/system/ref forms) straight into `mise latest`; muscle memory from `mise use` syntax applied to `latest`.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/8d0f0180f52787ce. Report an issue: GitHub.