{"record":{"id":"697b34b31b9ced83","repo":"jdx/mise","slug":"invalid-tool-version-request-s","errorCode":null,"errorMessage":"invalid tool version request: {s}","messagePattern":"invalid tool version request: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/toolset/tool_request.rs","lineNumber":168,"sourceCode":"            }\n            None => {\n                if s == \"system\" {\n                    Self::System {\n                        options,\n                        backend,\n                        source,\n                    }\n                } else {\n                    validate_version_string(&s)?;\n                    Self::Version {\n                        version: s,\n                        options,\n                        backend,\n                        source,\n                    }\n                }\n            }\n            _ => bail!(\"invalid tool version request: {s}\"),\n        })\n    }\n\n    /// Construct an unvalidated version request for tests that exercise paths\n    /// derived from otherwise-invalid version strings.\n    #[cfg(test)]\n    pub(crate) fn new_version_for_test(\n        backend: Arc<BackendArg>,\n        version: &str,\n        source: ToolSource,\n    ) -> Self {\n        let options = backend.resolve_opts_with_config_and_request(None, None);\n        Self::Version {\n            backend,\n            version: version.to_string(),\n            options,\n            source,\n        }","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/toolset/tool_request.rs#L150-L186","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use valid syntax 'tool@version' or 'tool@latest' in config/CLI (e.g. node@22.0.0)","Check the exact string being passed — log it if it comes from a script or env var","Trim whitespace and remove stray characters around the version spec","Consult `mise registry` for correct tool names and valid version formats"],"exampleFix":"// before\n[tools]\nnode = 'lts unsupported'\n// after\n[tools]\nnode = '22'","handlingStrategy":"validation","validationCode":"// validate spec shape before creating a request\nconst validSpec = (s) => /^[^@\\s]+@([^@\\s]+)$/.test(s.trim());\nif (!validSpec(spec)) throw new Error('bad spec: '+spec);","typeGuard":"const isToolSpec = (v) => typeof v === 'string' && v.includes('@') && !v.trim().endsWith('@');","tryCatchPattern":"try { req = ToolRequest.newWithOptions(spec, opts) } catch (e) { if (String(e).startsWith('invalid tool version request')) { printUsageAndExit(1); } else { throw e; } }","preventionTips":["Always use 'tool@version' syntax with a non-empty version","Trim whitespace from interpolated values","Don't pass raw user input as version specs without validation","Check tool names with `mise registry`"],"tags":["parsing","version","toolset"],"backgroundTag":"invalid-argument-format","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}