{"record":{"id":"4847e6e57a01cffb","repo":"jdx/mise","slug":"invalid-prefix","errorCode":null,"errorMessage":"invalid prefix: {}","messagePattern":"invalid prefix: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/args/tool_arg.rs","lineNumber":71,"sourceCode":"    }\n}\n\nimpl FromStr for ToolVersionType {\n    type Err = eyre::Error;\n\n    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        trace!(\"parsing ToolVersionType from: {}\", s);\n        Ok(match s.split_once(':') {\n            Some((ref_type @ (\"ref\" | \"tag\" | \"branch\" | \"rev\"), r)) => {\n                Self::Ref(ref_type.to_string(), r.to_string())\n            }\n            Some((\"prefix\", p)) => Self::Prefix(p.to_string()),\n            Some((\"path\", p)) => Self::Path(PathBuf::from(p)),\n            Some((p, v)) if p.starts_with(\"sub-\") => Self::Sub {\n                sub: p.split_once('-').unwrap().1.to_string(),\n                orig_version: v.to_string(),\n            },\n            Some((p, _)) => bail!(\"invalid prefix: {}\", style::ered(p)),\n            None if s == \"system\" => Self::System,\n            None => Self::Version(s.to_string()),\n        })\n    }\n}\n\nimpl Display for ToolVersionType {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        match self {\n            Self::Path(p) => write!(f, \"path:{}\", p.to_string_lossy()),\n            Self::Prefix(p) => write!(f, \"prefix:{p}\"),\n            Self::Ref(rt, r) => write!(f, \"{rt}:{r}\"),\n            Self::Sub { sub, orig_version } => write!(f, \"sub-{sub}:{orig_version}\"),\n            Self::System => write!(f, \"system\"),\n            Self::Version(v) => write!(f, \"{v}\"),\n        }\n    }\n}","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/args/tool_arg.rs#L53-L89","documentation":"Thrown by the FromStr impl of ToolVersionType (src/cli/args/tool_arg.rs:71) when the version half of a tool spec contains ':' and the segment before the first colon is not a recognized prefix - only ref, tag, branch, rev, prefix, path, and sub-<name> are allowed. Any other text before a colon is rejected as an 'invalid prefix'.","triggerScenarios":"'mise use tool@2024.01.15T10:30' (timestamp containing colons), 'mise use tool@channel:stable' (channel is not a prefix), 'subpython:3.12' instead of 'sub-python:3.12', or argument-order mixups that drop a path/URL into the version position.","commonSituations":"Version strings pasted from release notes or build stamps that contain ISO timestamps; users expecting docker-style 'name:tag' syntax; scripts interpolating $TIME or git refs into versions.","solutions":["Wrap colon-containing versions in a recognized prefix - 'prefix:' keeps everything after the first colon: 'mise use tool@prefix:2024.01.15T10:30'","Use the supported prefixes as intended: ref:, tag:, branch:, rev:, prefix:, path:/abs/path, sub-<name>:","Strip colons from generated version strings before passing them to mise","Double-check sub-tool syntax: it must be 'sub-<name>:<version>'"],"exampleFix":"# before\nmise use mytool@2024.01.15T10:30\n# Error: invalid prefix: 2024.01.15T10\n\n# after\nmise use mytool@prefix:2024.01.15T10:30","handlingStrategy":"type-guard","validationCode":"# bash: reject version specs with an unrecognized prefix before calling mise\nis_valid_version() {\n  case \"$1\" in\n    ref:*|tag:*|branch:*|rev:*|prefix:*|path:*|sub-*:*) return 0 ;;\n    system) return 0 ;;\n    *:*) return 1 ;;\n    *) return 0 ;;\n  esac\n}\nis_valid_version \"$VER\" || { echo \"invalid version spec: $VER\" >&2; exit 1; }","typeGuard":"// Rust guard mirroring ToolVersionType::from_str acceptance\nfn is_valid_version_spec(s: &str) -> bool {\n    match s.split_once(':') {\n        Some((p, _)) => {\n            matches!(p, \"ref\" | \"tag\" | \"branch\" | \"rev\" | \"prefix\" | \"path\") || p.starts_with(\"sub-\")\n        }\n        None => true,\n    }\n}","tryCatchPattern":null,"preventionTips":["Sanitize generated version strings (strip colons) in build scripts","Use prefix: when a version legitimately contains colons","Reserve colons for the documented prefixes; never docker-style name:tag"],"tags":["mise","version-specifier","cli-args","parsing"],"backgroundTag":"invalid-version-specifier","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}