{"record":{"id":"4766ae7eb368b96d","repo":"jdx/mise","slug":"cannot-combine-flag-with-an-inline-key-option","errorCode":null,"errorMessage":"cannot combine {flag} with an inline {key} option for {}","messagePattern":"cannot combine (.+?) with an inline (.+?) option for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/use.rs","lineNumber":221,"sourceCode":"                .and_then(|mut table| table.remove(\"value\"))\n                .unwrap_or_else(|| toml::Value::String(value.to_string()));\n            entries.push((key.to_string(), value, \"--tool-option\"));\n        }\n        let mut seen = std::collections::HashSet::new();\n        for (key, value, flag) in entries {\n            if !seen.insert(key.clone()) {\n                bail!(\n                    \"tool option {key:?} was specified more than once for {}\",\n                    self.tool\n                );\n            }\n            if self\n                .tool\n                .ba\n                .explicit_opts()\n                .is_some_and(|options| options.contains_key(&key))\n            {\n                bail!(\n                    \"cannot combine {flag} with an inline {key} option for {}\",\n                    self.tool\n                );\n            }\n            options\n                .insert_option(key, value)\n                .map_err(|error| eyre!(error))?;\n        }\n        Ok(options)\n    }\n}\n\nimpl Use {\n    pub(super) fn is_dry_run(&self) -> bool {\n        self.dry_run || self.dry_run_code\n    }\n\n    pub(crate) async fn run(mut self) -> Result<()> {","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/use.rs#L203-L239","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Remove one of the two occurrences — keep the value either inline in the tool string or as the flag, not both","Prefer the flag form: mise use node --tool-option key=value (drop the [key=value] from the tool spec)","Prefer the inline form if the tool documents bracket options as canonical, and drop the flag"],"exampleFix":"// before\nmise use 'node[flavor=lts]' --tool-option flavor=system\n// after\nmise use node --tool-option flavor=system","handlingStrategy":"validation","validationCode":"const inline = [...toolSpec.matchAll(/([\\w-]+)=[^\\]\\[,]*/g)].map(m=>m[1]);\nconst flagged = toolOptions.map(o=>o.split('=')[0]);\nconst clash = flagged.filter(k=>inline.includes(k));\nif (clash.length) throw new Error(`options set both inline and via flag: ${clash}`);","typeGuard":"const conflictsWithInline = (inlineKeys: string[], flagKeys: string[]) =>\n  flagKeys.filter(k => inlineKeys.includes(k));","tryCatchPattern":"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; }","preventionTips":["Choose one style (inline brackets or flags) per tool in scripts","Parse tool specs before adding flags to detect existing keys","Standardize team scripts on the flag form for readability"],"tags":["cli","tool-options","mutually-exclusive"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}