jdx/mise · error

cannot combine {flag} with an inline {key} option for {}

Error message

cannot combine {flag} with an inline {key} option for {}

What it means

The tool was invoked with inline options embedded in the tool string (e.g. `node[a=b]`) and additionally the same key was passed via a flag (--tool-option/--env, tracked by `flag`). request_options() refuses the ambiguous combination when the key already exists in the tool's explicit_opts().

Source

Thrown at src/cli/use.rs:222

                .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))?;
        }
        Ok(options)
    }
}

impl Use {
    pub(super) fn is_dry_run(&self) -> bool {
        self.dry_run || self.dry_run_code
    }

    pub(crate) async fn run(mut self) -> Result<()> {

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Remove the inline option from the tool string and keep the flag.
  2. Or remove the redundant --tool-option flag and rely on the inline option.

Example fix

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

Strategy: validation

Validate before calling

[[ "$tool" == *'['*']' ]] && echo 'inline options present; do not pass --tool-option for the same keys'

Prevention

When it happens

Trigger: `mise use 'node[opt=x]' --tool-option opt=y` — the key `opt` present in ba.explicit_opts() collides with the flag-provided key in request_options().

Common situations: Mixing bracketed inline tool options with --tool-option flags; extending an existing command line by appending a flag without noticing the inline options.

Related errors


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