jdx/mise · error

tool option was specified more than once for

Error message

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

What it means

Options accumulate across --tool-option and related flags into one set per tool. mise collects entries, deduplicates by key via a HashSet, and refuses when the same key appears more than once, since it cannot decide which value wins.

Solutions

  1. Remove the duplicate occurrence and keep a single KEY=VALUE per key
  2. If you need to override, pass only the new value once
  3. Use a config file (mise.toml [tools] options) when several option values must coexist or be version-controlled

Example fix

// before
mise use node --tool-option a=1 --tool-option a=2
// after
mise use node --tool-option a=2
Defensive patterns

Strategy: validation

Validate before calling

const seen = new Set();
for (const o of toolOptions) {
  const k = o.split('=')[0];
  if (seen.has(k)) throw new Error(`duplicate tool option: ${k}`);
  seen.add(k);
}

Type guard

const hasDuplicateKeys = (opts: string[]) => {
  const keys = opts.map(o => o.split('=')[0]);
  return new Set(keys).size !== keys.length;
};

Try / catch

try { exec(`mise use ${flags} ${tool}`); } catch (e) { if (String(e).includes('more than once')) console.error('dedupe --tool-option keys; pass only one value per key'); throw e; }

Prevention

When it happens

Trigger: `mise use node --tool-option a=1 --tool-option a=2`, or combining --tool-option and --raw-tool-option with the same key for the same tool in one invocation.

Common situations: Loops in scripts appending the same option repeatedly; merging flag lists from config/docs where the same key was set twice; overriding an option by repeating it, expecting last-wins semantics.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at src/cli/use.rs:210

        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 533346cc37)