jdx/mise · error

cannot combine with an inline option for

Error message

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

What it means

Some tools accept inline options embedded in the tool string (parsed into the tool request's explicit_opts via `ba.explicit_opts()`). Passing the same option key via a dedicated flag while it is also inline in the tool spec is rejected to avoid ambiguity about which value applies.

Solutions

  1. Remove one of the two occurrences — keep the value either inline in the tool string or as the flag, not both
  2. Prefer the flag form: mise use node --tool-option key=value (drop the [key=value] from the tool spec)
  3. Prefer the inline form if the tool documents bracket options as canonical, and drop the flag

Example fix

// before
mise use 'node[flavor=lts]' --tool-option flavor=system
// after
mise use node --tool-option flavor=system
Defensive patterns

Strategy: validation

Validate before calling

const inline = [...toolSpec.matchAll(/([\w-]+)=[^\]\[,]*/g)].map(m=>m[1]);
const flagged = toolOptions.map(o=>o.split('=')[0]);
const clash = flagged.filter(k=>inline.includes(k));
if (clash.length) throw new Error(`options set both inline and via flag: ${clash}`);

Type guard

const conflictsWithInline = (inlineKeys: string[], flagKeys: string[]) =>
  flagKeys.filter(k => inlineKeys.includes(k));

Try / catch

try { exec(`mise use '${spec}' ${flags}`); } catch (e) { if (String(e).includes('cannot combine')) console.error('pick either inline [k=v] options or --tool-option, not both for the same key'); throw e; }

Prevention

When it happens

Trigger: `mise use 'node[flavor=...]' --tool-option flavor=system` — any flag/value (--tool-option or --raw-tool-option) whose key already exists in the tool spec's inline options.

Common situations: Combining an autocomplete-inserted inline bracket option with a hand-added flag; migrating an old command line where the option was flag-only or inline-only and merging both styles.

Related errors


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

Appendix: source

Thrown at src/cli/use.rs:221

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