jdx/mise · error

invalid value ; expected one of

Error message

invalid {name} value {invalid:?}; expected one of: {}

What it means

`validate_setting_enum_values` validates that settings whose value is restricted to a fixed set of strings actually hold one of the allowed values. If any supplied value is not in the allow-list, mise bails naming the setting, the bad value, and the valid options. This runs during settings validation/load.

Solutions

  1. Use one of the values listed after 'expected one of:' in the error message.
  2. Run `mise settings` (or check docs/mise.jdx.dev) to see valid values for the setting.
  3. After upgrading mise, re-check settings whose allowed values may have been renamed.

Example fix

# before (mise.toml)
[settings]
node_compile = "yes"

# after
[settings]
node_compile = "true"  # or whichever value the setting's allow-list defines
Defensive patterns

Strategy: validation

Validate before calling

# shell: verify a setting value against mise's own output before writing it
mise settings get <name> 2>/dev/null || mise settings docs <name>  # confirm allowed values

Prevention

When it happens

Trigger: Setting any enum-typed setting (e.g. via `mise settings set <name> <value>`, config TOML, or MISE_ env vars) to a string not in the setting's allowed values list.

Common situations: Typos in setting values; copying a value from an older mise version where the enum had different members; documentation drift where the valid set changed between releases.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/886dd353d0360012. Report an issue: GitHub.

Appendix: source

Thrown at src/config/settings.rs:2111

            let trimmed = s.trim();
            if !trimmed.is_empty() {
                Some(T::from_str(trimmed))
            } else {
                None
            }
        })
        // collect into BTreeSet to remove duplicates
        .collect::<Result<BTreeSet<_>, _>>()
        .map(|set| set.into_iter().collect())
}

fn validate_setting_enum_values<'a>(
    name: &str,
    values: impl IntoIterator<Item = &'a str>,
    allowed: &[&str],
) -> Result<()> {
    if let Some(invalid) = values.into_iter().find(|value| !allowed.contains(value)) {
        bail!(
            "invalid {name} value {invalid:?}; expected one of: {}",
            allowed.join(", ")
        );
    }
    Ok(())
}

fn normalize_tool_names(tools: &BTreeSet<String>) -> BTreeSet<String> {
    tools
        .iter()
        .map(|t| t.trim())
        .filter(|t| !t.is_empty())
        .map(str::to_string)
        .collect()
}

fn split_default_shell_or_fallback(sa: &str, fallback: &str) -> Result<Vec<String>> {
    let shell = crate::path::split_shell_command(sa)?;

View on GitHub (pinned to 533346cc37)