jdx/mise · error
version_order must be "source" or "semver"
Error message
version_order must be "source" or "semver"
What it means
VersionOrder::from_options_or parses the `version_order` tool option. This throw site handles the non-string TOML value case (Some(_) arm): if version_order is present but is not a TOML string (e.g. an integer, boolean, or table), it bails demanding the string "source" or "semver".
Solutions
- Quote the value: `version_order = "semver"` or `version_order = "source"` in mise.toml.
- Remove the option if ordering customization is not needed (the default applies).
- Ensure any code building ToolVersionOptions inserts a toml::Value::String for this key.
Example fix
// before (mise.toml) version_order = semver # parsed as non-string // after version_order = "semver"
Defensive patterns
Strategy: validation
Validate before calling
# validate version_order is a quoted string in TOML mise config get ./mise.toml | grep version_order
Prevention
- Always quote TOML string values: version_order = "semver"
- Run `mise doctor` or the mise.toml JSON schema validation in editors
- Enable TOML language server schema checking for mise.toml
When it happens
Trigger: Setting `version_order = 1`, `version_order = true`, or `version_order = ["semver"]` in tool options — any non-string TOML value passed to from_options_or.
Common situations: Typo in mise.toml omitting quotes around "semver" so TOML parses it as a bare key/table; programmatic construction of ToolVersionOptions with a non-string value.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- backend must be a string or table
- expected `run` to be a string or array of strings
- expected value of to be a , got
- [history] exclude in
- [history] in is not a table
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/98cb711c02ecf19a.
Report an issue: GitHub.
Appendix: source
Thrown at src/backend/options.rs:29
pub(crate) enum VersionOrder {
#[default]
Source,
Semver,
}
impl VersionOrder {
#[cfg(test)]
pub(crate) fn from_options(options: &ToolVersionOptions) -> Result<Self> {
Self::from_options_or(options, Self::Source)
}
pub(crate) fn from_options_or(options: &ToolVersionOptions, default: Self) -> Result<Self> {
match options.opts.get("version_order") {
None => Ok(default),
Some(toml::Value::String(value)) => match value.as_str() {
"source" => Ok(Self::Source),
"semver" => Ok(Self::Semver),
_ => bail!("version_order must be \"source\" or \"semver\""),
},
Some(_) => bail!("version_order must be \"source\" or \"semver\""),
}
}
pub(crate) fn order(self, versions: Vec<String>) -> Vec<String> {
self.order_by(versions, String::as_str)
}
pub(crate) fn order_by<T, F>(self, versions: Vec<T>, version: F) -> Vec<T>
where
F: for<'a> Fn(&'a T) -> &'a str,
{
if self == Self::Source {
return versions;
}
let mut opaque = Vec::new();View on GitHub (pinned to 533346cc37)