{"record":{"id":"9adae16e9c4ee044","repo":"jdx/mise","slug":"tool-option-key-was-specified-more-than-once-f","errorCode":null,"errorMessage":"tool option {key:?} was specified more than once for {}","messagePattern":"tool option (.+?) was specified more than once for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/use.rs","lineNumber":211,"sourceCode":"        for option in &self.tool_option {\n            let (key, value) = option\n                .split_once('=')\n                .ok_or_else(|| eyre!(\"--tool-option expects KEY=VALUE: {option}\"))?;\n            let key = key.trim();\n            if key.is_empty() {\n                bail!(\"--tool-option requires a non-empty key\");\n            }\n            let value = toml::from_str::<toml::Table>(&format!(\"value = {value}\"))\n                .ok()\n                .filter(|table| table.len() == 1)\n                .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))?;","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/use.rs#L193-L229","documentation":"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.","triggerScenarios":"`mise use <tool> --tool-option k=v1 --tool-option k=v2` where `seen.insert(key)` returns false in request_options().","commonSituations":"Script loops appending duplicate options; copy-paste of an option line; combining flags that expand to the same key.","solutions":["Remove the duplicate --tool-option occurrence.","If you need to override, drop the earlier occurrence and keep the intended value once."],"exampleFix":"// before\nmise use node --tool-option cache=true --tool-option cache=false\n// after\nmise use node --tool-option cache=false","handlingStrategy":"validation","validationCode":"declare -A seen; for kv in \"$@\"; do k=\"${kv%%=*}\"; [ -z \"${seen[$k]:-}\" ] || { echo \"duplicate option $k\"; exit 1; }; seen[$k]=1; done","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Deduplicate --tool-option keys before invoking mise use.","Build option lists from associative arrays/maps keyed by option name.","Review composed command lines for repeated keys."],"tags":["cli","tool-options","duplicate-key"],"backgroundTag":"conflicting-config-options","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}