jdx/mise · error

invalid tool version request: {s}

Error message

invalid tool version request: {s}

What it means

ToolRequest::new_with_options parses a tool version string like 'node@22' or 'node@latest'. If the string doesn't match any recognized request syntax (no @/path/ref/etc. form), parsing falls through to the catch-all bail with this message, since mise cannot interpret the request.

Source

Thrown at src/toolset/tool_request.rs:168

            }
            None => {
                if s == "system" {
                    Self::System {
                        options,
                        backend,
                        source,
                    }
                } else {
                    validate_version_string(&s)?;
                    Self::Version {
                        version: s,
                        options,
                        backend,
                        source,
                    }
                }
            }
            _ => bail!("invalid tool version request: {s}"),
        })
    }

    /// Construct an unvalidated version request for tests that exercise paths
    /// derived from otherwise-invalid version strings.
    #[cfg(test)]
    pub(crate) fn new_version_for_test(
        backend: Arc<BackendArg>,
        version: &str,
        source: ToolSource,
    ) -> Self {
        let options = backend.resolve_opts_with_config_and_request(None, None);
        Self::Version {
            backend,
            version: version.to_string(),
            options,
            source,
        }

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Use valid syntax 'tool@version' or 'tool@latest' in config/CLI (e.g. node@22.0.0)
  2. Check the exact string being passed — log it if it comes from a script or env var
  3. Trim whitespace and remove stray characters around the version spec
  4. Consult `mise registry` for correct tool names and valid version formats

Example fix

// before
[tools]
node = 'lts unsupported'
// after
[tools]
node = '22'
Defensive patterns

Strategy: validation

Validate before calling

// validate spec shape before creating a request
const validSpec = (s) => /^[^@\s]+@([^@\s]+)$/.test(s.trim());
if (!validSpec(spec)) throw new Error('bad spec: '+spec);

Type guard

const isToolSpec = (v) => typeof v === 'string' && v.includes('@') && !v.trim().endsWith('@');

Try / catch

try { req = ToolRequest.newWithOptions(spec, opts) } catch (e) { if (String(e).startsWith('invalid tool version request')) { printUsageAndExit(1); } else { throw e; } }

Prevention

When it happens

Trigger: Passing a malformed version spec to ToolRequest::new_with_options — e.g. calling the API/CLI with 'node' when a version is required, a typo'd prefix, or an unsupported syntax form in tools config.

Common situations: Typos in mise.toml tools entries (missing '@version'), invalid specs like 'node@' with empty version or stray characters, scripts passing user input straight into `mise use` or ToolRequest.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/697b34b31b9ced83. Report an issue: GitHub.