{"record":{"id":"9572b4ff7222ef8d","repo":"jdx/mise","slug":"conflicting-options-for-key-multiple-requests-s","errorCode":null,"errorMessage":"conflicting options for {key}: multiple requests share the same install destination","messagePattern":"conflicting options for (.+?): multiple requests share the same install destination","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/toolset/tool_deps.rs","lineNumber":27,"sourceCode":"pub(super) type ToolKey = String;\n\n/// Creates a unique key for a ToolRequest\npub(crate) fn tool_key(tr: &ToolRequest) -> ToolKey {\n    format!(\"{}@{}\", tr.ba().short, tr.version())\n}\n\n/// Multiple option variants cannot safely share one install destination.\n/// Reject them before any install job starts instead of letting one variant\n/// silently satisfy (or race with) another.\npub(crate) fn ensure_compatible_install_requests(requests: &[ToolRequest]) -> Result<()> {\n    let mut options_by_destination = std::collections::HashMap::new();\n    for request in requests {\n        let key = tool_key(request);\n        let options = request.options();\n        if let Some(existing) = options_by_destination.get(&key)\n            && existing != &options\n        {\n            bail!(\n                \"conflicting options for {key}: multiple requests share the same install destination\"\n            );\n        }\n        options_by_destination.insert(key, options);\n    }\n    Ok(())\n}\n\n/// Manages a dependency graph of tools for installation scheduling.\n/// Thin wrapper around `DepsGraph<ToolKey, ToolRequest>` with\n/// tool-specific dependency resolution.\n#[derive(Debug)]\npub(super) struct ToolDeps {\n    inner: DepsGraph<ToolKey, ToolRequest>,\n}\n\nimpl ToolDeps {\n    /// Creates a new ToolDeps from a list of tool requests.","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/toolset/tool_deps.rs#L9-L45","documentation":"`ensure_compatible_install_requests` groups runtime install requests by install destination (tool_key). If two requests target the same destination but carry different options, the result would be ambiguous, so it bails naming the conflicting key. It runs before runtime installs (install_runtimes, install_missing_runtimes, new, install_all_versions_with_progress).","triggerScenarios":"Calling one of the install entry points with multiple requests whose `tool_key` matches but whose `options()` differ — e.g. the same tool requested twice with different env/settings/install options.","commonSituations":"A project config and a global config both requesting the same tool with different flags; a task installing runtimes with options that clash with toolset config; duplicate tool entries with differing options.","solutions":["Remove or align the duplicate requests so all requests for the same destination use identical options.","Consolidate the tool's configuration into a single place (one mise.toml entry) instead of multiple conflicting ones.","Check the merged config hierarchy (system/global/project) for conflicting options for that tool.","If the API is yours, deduplicate requests by tool_key before calling the installer."],"exampleFix":"// before\n[tools]\nnode = { version = \"20\", options = { flags = \"--lts\" } }\nnode = { version = \"20\" }  # duplicate with different options\n// after\n[tools]\nnode = { version = \"20\", options = { flags = \"--lts\" } }","handlingStrategy":"validation","validationCode":"let mut by_key: HashMap<String, Options> = HashMap::new();\nfor r in requests { let k = tool_key(r); if let Some(prev) = by_key.get(&k) { assert_eq!(prev, &r.options(), \"conflicting options for {k}\"); } by_key.insert(k, r.options()); }","typeGuard":null,"tryCatchPattern":"match ensure_compatible_install_requests(&requests) { Err(e) if e.to_string().starts_with(\"conflicting options\") => { let key = extract_key(&e); requests.retain(|r| tool_key(r) != key); /* retry */ }, other => other? }","preventionTips":["Define each tool's options in exactly one config layer.","Deduplicate tool requests before passing them to install APIs.","Keep options stable across project and global configs for shared tools."],"tags":["config","conflict","installation"],"backgroundTag":"conflicting-config-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"}