{"record":{"id":"47d57b12f3fc862f","repo":"jdx/mise","slug":"overlapping-macos-defaults-declarations-other-request","errorCode":null,"errorMessage":"overlapping macOS defaults declarations: {other}; {request}","messagePattern":"overlapping macOS defaults declarations: (.+?); (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/defaults.rs","lineNumber":313,"sourceCode":"        if let Some(path) = &request.path {\n            eyre::ensure!(\n                !path.is_empty(),\n                \"defaults patch path must not be empty: {request}\"\n            );\n        }\n        for other in &requests[..i] {\n            if canonical_domain(&request.domain) != canonical_domain(&other.domain)\n                || request.key != other.key\n                || request.host != other.host\n            {\n                continue;\n            }\n            let overlaps = match (&request.path, &other.path) {\n                (None, None) => false, // Preserve existing whole-value declarations.\n                (Some(a), Some(b)) => a.starts_with(b) || b.starts_with(a),\n                _ => true,\n            };\n            eyre::ensure!(\n                !overlaps,\n                \"overlapping macOS defaults declarations: {other}; {request}\"\n            );\n        }\n    }\n    Ok(())\n}\n\nfn selected_value<'a>(\n    mut current: Option<&'a plist::Value>,\n    request: &DefaultsRequest,\n) -> Result<Option<&'a plist::Value>> {\n    if let Some(path) = &request.path {\n        for component in path {\n            current = match current {\n                Some(plist::Value::Dictionary(dict)) => dict.get(component),\n                None => return Ok(None),\n                Some(_) => eyre::bail!(\"expected dictionary along defaults patch path: {request}\"),","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/defaults.rs#L295-L331","documentation":"Thrown by validate_requests when two macOS defaults requests target the same canonical domain with overlapping patch paths. If both requests have paths and one is a prefix of the other (e.g. \"a\" and \"a.b\"), or only one has a path (mixing whole-domain and sub-path patches), the writes would conflict; the loader refuses rather than applying ambiguous precedence. Two whole-domain requests (both paths None) are allowed to preserve existing behavior.","triggerScenarios":"Passing two DefaultsRequests with equal canonical domains to defaults status/apply/prepare_writes where path pairs are (Some,Some) prefix-related or (Some,None)/(None,Some).","commonSituations":"Declaring the same macOS domain twice in bootstrap config — once at the top level and once with a subkey path; two config files (user + project) both patching com.apple.dock; generated requests that duplicate a domain with refined paths.","solutions":["Merge the overlapping declarations into a single request per domain","Make sibling paths non-overlapping (e.g. patch \"a.c\" and \"a.b\", not \"a\" and \"a.b\")","Remove the duplicate domain entry from one of the config files","If both declarations are whole-domain (no path), leave as-is — those are intentionally allowed"],"exampleFix":"// before: two requests on com.apple.dock\n{ domain: \"com.apple.dock\", path: Some(\"tilesize\") }\n{ domain: \"com.apple.dock\", path: Some(\"tilesize.orientation\") }\n// after: non-overlapping paths\n{ domain: \"com.apple.dock\", path: Some(\"tilesize\") }\n{ domain: \"com.apple.dock\", path: Some(\"orientation\") }","handlingStrategy":"validation","validationCode":"fn validate_no_overlap(reqs: &[DefaultsRequest]) -> Result<(), String> {\n    for i in 0..reqs.len() {\n        for j in 0..i {\n            let (a, b) = (&reqs[i], &reqs[j]);\n            let overlaps = match (&a.path, &b.path) {\n                (None, None) => false,\n                (Some(x), Some(y)) => x.starts_with(y.as_str()) || y.starts_with(x.as_str()),\n                _ => true,\n            };\n            if overlaps && a.domain == b.domain {\n                return Err(format!(\"overlapping defaults: {} and {}\", a.domain, b.domain));\n            }\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare each macOS domain in exactly one config layer","Use disjoint sibling paths when multiple patches per domain are needed","Review merged bootstrap configs for repeated domains"],"tags":["macos","defaults","validation","conflict"],"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"}