jdx/mise · error

tool option {key:?} was specified more than once for {}

Error message

tool option {key:?} was specified more than once for {}

What it means

Duplicate-flag validation in `mise use` request_options(): the same --tool-option key was given more than once on the command line for one tool. The parser collects per-tool options into a map and rejects conflicting repeats rather than silently overwriting.

Source

Thrown at src/cli/use.rs:211

        for option in &self.tool_option {
            let (key, value) = option
                .split_once('=')
                .ok_or_else(|| eyre!("--tool-option expects KEY=VALUE: {option}"))?;
            let key = key.trim();
            if key.is_empty() {
                bail!("--tool-option requires a non-empty key");
            }
            let value = toml::from_str::<toml::Table>(&format!("value = {value}"))
                .ok()
                .filter(|table| table.len() == 1)
                .and_then(|mut table| table.remove("value"))
                .unwrap_or_else(|| toml::Value::String(value.to_string()));
            entries.push((key.to_string(), value, "--tool-option"));
        }
        let mut seen = std::collections::HashSet::new();
        for (key, value, flag) in entries {
            if !seen.insert(key.clone()) {
                bail!(
                    "tool option {key:?} was specified more than once for {}",
                    self.tool
                );
            }
            if self
                .tool
                .ba
                .explicit_opts()
                .is_some_and(|options| options.contains_key(&key))
            {
                bail!(
                    "cannot combine {flag} with an inline {key} option for {}",
                    self.tool
                );
            }
            options
                .insert_option(key, value)
                .map_err(|error| eyre!(error))?;

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Remove the duplicate --tool-option occurrence.
  2. If you need to override, drop the earlier occurrence and keep the intended value once.

Example fix

// before
mise use node --tool-option cache=true --tool-option cache=false
// after
mise use node --tool-option cache=false
Defensive patterns

Strategy: validation

Validate before calling

declare -A seen; for kv in "$@"; do k="${kv%%=*}"; [ -z "${seen[$k]:-}" ] || { echo "duplicate option $k"; exit 1; }; seen[$k]=1; done

Prevention

When it happens

Trigger: `mise use <tool> --tool-option k=v1 --tool-option k=v2` where `seen.insert(key)` returns false in request_options().

Common situations: Script loops appending duplicate options; copy-paste of an option line; combining flags that expand to the same key.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/9adae16e9c4ee044. Report an issue: GitHub.