{"record":{"id":"cbc337413d8a3c1e","repo":"jdx/mise","slug":"conflicting-managed-directory-declarations-for","errorCode":null,"errorMessage":"conflicting managed directory declarations for {}\n\n  first:\n    {}\n\n  second:\n    {}","messagePattern":"conflicting managed directory declarations for (.+?)\n\n  first:\n    (.+?)\n\n  second:\n    (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/managed_files.rs","lineNumber":455,"sourceCode":"                merged\n                    .entry(target)\n                    .or_insert_with(|| (file, base.clone(), file_origin));\n            }\n        }\n    }\n    Ok(merged)\n}\n\nfn directories_from_config(config: &Config) -> Result<Vec<ManagedDirectoryRequest>> {\n    let mut composed: IndexMap<PathBuf, (ManagedDirectoryTomlConfig, ResourceOrigin)> =\n        IndexMap::new();\n    for config_files in config.bootstrap_config_maps() {\n        for (path, declaration) in directories_from_config_files(config_files)? {\n            if let Some(existing) = composed.get(&path) {\n                if existing.0 == declaration.0 {\n                    continue;\n                }\n                bail!(\n                    \"conflicting managed directory declarations for {}\\n\\n  first:\\n    {}\\n\\n  second:\\n    {}\",\n                    path.display(),\n                    existing.1.conflict_description(),\n                    declaration.1.conflict_description(),\n                );\n            }\n            composed.insert(path, declaration);\n        }\n    }\n    composed\n        .into_iter()\n        .map(|(path, (config, origin))| ManagedDirectoryRequest::from_toml(path, config, origin))\n        .collect()\n}\n\n/// Merges managed directories within one config hierarchy using normal precedence.\nfn directories_from_config_files(\n    config_files: &ConfigMap,","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/managed_files.rs#L437-L473","documentation":"Thrown when merging managed directory declarations across config layers for the same path whose declaration values differ (e.g. different create/remove semantics or attributes), while composing directories from bootstrap config maps. Exactly-equal duplicate declarations are deduplicated silently; a real conflict stops validation with both declarations' conflict descriptions in the message.","triggerScenarios":"The same directory path declared in multiple bootstrap config layers with differing flags/attributes; an environment-specific config overriding a directory declaration's settings unintentionally.","commonSituations":"Global config declares `/var/log/myapp` as managed and a project config redeclares it with different options; refactors that change directory semantics in one layer only; two included config files diverging over time.","solutions":["Read the 'first'/'second' conflict descriptions to identify the differing attribute.","Align the declarations across layers or delete one of them.","Concentrate the authoritative directory declaration in the most specific layer intended to own it."],"exampleFix":"# before: global says {create=true}, project says {create=false} for /var/log/myapp\n# after: single declaration in the owning layer\n[bootstrap.directories]\n\"/var/log/myapp\" = { create = true }","handlingStrategy":"validation","validationCode":"seen = {}\nfor layer in layers:\n  for path, decl in layer.directories.items():\n    if path in seen and seen[path] != decl:\n      raise SystemExit(f'conflicting directory decl for {path}')\n    seen[path] = decl","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare each managed directory once, in its owning layer.","Keep directory options identical across layers if duplication is required.","Review directory overrides when adding new config layers."],"tags":["config","managed-directories","conflict","merge"],"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"}