jdx/mise · error

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

Error message

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

What it means

This error is thrown when a mise settings value is not one of the allowed enum values for that setting. `validate_setting_enum_values` iterates the provided values and bails with the setting name, the offending value, and the list of allowed values. It is the generic validator used wherever a setting is restricted to a fixed set of strings.

Source

Thrown at src/config/settings.rs:1969

            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 afd2eddd3a)

Solutions

  1. Read the 'expected one of: ...' list in the message and set the value to exactly one of those strings
  2. Run `mise settings` (or check docs/settings.toml) to see valid values for the key
  3. Check for typos and case sensitivity in the value
  4. Verify the setting exists in your mise version; the allowed set may differ across releases

Example fix

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

// after
[settings]
node_compile = "true"
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = ["true", "false", "auto"]; // per setting
if (!ALLOWED.includes(value)) throw new Error(`invalid ${key} value ${value}; expected one of: ${ALLOWED.join(", ")}`);

Prevention

When it happens

Trigger: Setting a settings key (e.g. via `mise settings set <key> <value>`, mise.toml `[settings]`, or MISE_<KEY> env vars) to a string that is not in the setting's allowed list; the invalid value is rejected at settings validation time.

Common situations: Typos in a settings value ('true' vs 'tru', wrong casing), copying a value valid for one setting into another, upgrading/downgrading mise where the allowed set changed, or writing an env-var-based setting with a wrong literal.

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@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/886dd353d0360012. Report an issue: GitHub.