jdx/mise · error
invalid prefix
Error message
invalid prefix: {} What it means
ToolVersionType::from_str saw a `prefix:` version qualifier whose remainder p is rejected by the follow-on validation (the shown guard fires for a prefix segment that does not meet the parser's requirements). It means the tool request string like `tool@prefix:...` is malformed at the prefix value.
Solutions
- Use a supported prefix: `prefix:<v>`, `path:<p>`, or `sub-<name>:<v>`.
- Remove the unknown prefix and use a plain version string.
- If a ref/channel is intended, use the backend's supported syntax (e.g. `latest`, or backend-specific channel names).
Example fix
// before [tools] node = "min-22" // after [tools] node = "prefix:22"
Defensive patterns
Strategy: validation
Validate before calling
[[ "$ver" =~ ^(prefix:|path:|sub-[a-zA-Z0-9_-]+:)?[^:]+$ ]] || echo "unsupported prefix in $ver"
Prevention
- Memorize the supported prefixes: prefix:, path:, sub-<name>.
- Avoid colon syntax copied from other tools.
- Validate mise.toml against the schema (mise run render:schema / jsonschema).
When it happens
Trigger: Writing a version string like `foo:1.2` or `xyz-1.2` in mise.toml / .tool-versions where the leading segment is not a supported prefix.
Common situations: Typos in sub-<name> syntax (missing 'sub-' or wrong separator); copy-pasting version specs from other tools (e.g. 'ref:main' style not supported here).
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
- a branch name is required
- a glob is required
- a repository preview directory requires a dry run
- a repository url is required
- adoption requires confirmation; review the directory and…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/4847e6e57a01cffb.
Report an issue: GitHub.
Appendix: source
Thrown at src/cli/args/tool_arg.rs:75
}
}
impl FromStr for ToolVersionType {
type Err = eyre::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
trace!("parsing ToolVersionType from: {}", s);
Ok(match s.split_once(':') {
Some((ref_type @ ("ref" | "tag" | "branch" | "rev"), r)) => {
Self::Ref(ref_type.to_string(), r.to_string())
}
Some(("prefix", p)) => Self::Prefix(p.to_string()),
Some(("path", p)) => Self::Path(PathBuf::from(p)),
Some((p, v)) if p.starts_with("sub-") => Self::Sub {
sub: p.split_once('-').unwrap().1.to_string(),
orig_version: v.to_string(),
},
Some((p, _)) => bail!("invalid prefix: {}", style::ered(p)),
None if s == "system" => Self::System,
None => Self::Version(s.to_string()),
})
}
}
impl Display for ToolVersionType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Path(p) => write!(f, "path:{}", p.to_string_lossy()),
Self::Prefix(p) => write!(f, "prefix:{p}"),
Self::Ref(rt, r) => write!(f, "{rt}:{r}"),
Self::Sub { sub, orig_version } => write!(f, "sub-{sub}:{orig_version}"),
Self::System => write!(f, "system"),
Self::Version(v) => write!(f, "{v}"),
}
}
}View on GitHub (pinned to 533346cc37)