{"record":{"id":"b9d8a152aba2ad8e","repo":"jdx/mise","slug":"conflicting-managed-file-declarations-for-fi","errorCode":null,"errorMessage":"conflicting managed file declarations for {}\n\n  first:\n    {}\n\n  second:\n    {}","messagePattern":"conflicting managed file 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":379,"sourceCode":"        .into_iter()\n        .map(|(path, (file, base, origin))| {\n            ManagedFileRequest::from_toml(config, path, file, &base, origin, secrets)\n        })\n        .collect()\n}\n\nfn merged_files_from_config(\n    config: &Config,\n) -> Result<IndexMap<PathBuf, (ManagedFileTomlConfig, PathBuf, ResourceOrigin)>> {\n    let mut composed: IndexMap<PathBuf, (ManagedFileTomlConfig, PathBuf, ResourceOrigin)> =\n        IndexMap::new();\n    for config_files in config.bootstrap_config_maps() {\n        for (path, declaration) in merged_files_from_config_files(config_files)? {\n            if let Some(existing) = composed.get(&path) {\n                if managed_file_declarations_match(existing, &declaration) {\n                    continue;\n                }\n                bail!(\n                    \"conflicting managed file declarations for {}\\n\\n  first:\\n    {}\\n\\n  second:\\n    {}\",\n                    path.display(),\n                    existing.2.conflict_description(),\n                    declaration.2.conflict_description(),\n                );\n            }\n            composed.insert(path, declaration);\n        }\n    }\n    Ok(composed)\n}\n\n/// Returns whether sibling declarations produce the same managed file.\nfn managed_file_declarations_match(\n    first: &(ManagedFileTomlConfig, PathBuf, ResourceOrigin),\n    second: &(ManagedFileTomlConfig, PathBuf, ResourceOrigin),\n) -> bool {\n    first.0 == second.0","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/managed_files.rs#L361-L397","documentation":"Thrown when two config layers declare the same managed file path with declarations whose relevant attributes differ (e.g. different content source, mode, or ownership), detected while merging bootstrap config maps. Identical duplicate declarations are tolerated and deduplicated; only genuine conflicts bail. The error prints both conflicting declarations' conflict descriptions.","triggerScenarios":"The same file path appearing in multiple `bootstrap_config_maps()` layers (user, global, project, environment-specific configs) with differing file settings; an environment override changing a managed file's content or mode without intending to conflict.","commonSituations":"A project mise.toml overriding a managed file also declared in the user's global config with different permissions; team config drift where two environments redefine the same managed path; refactor leftovers duplicating a file declaration.","solutions":["Compare the 'first' and 'second' descriptions in the error to see which attributes differ.","Make the declarations identical across layers (if duplication is intentional) or remove one.","Move the differing declaration to the single most-specific layer that should own the file.","If both are needed, use different target paths for the two files."],"exampleFix":"# before (project overrides user with different mode)\n# user: /etc/motd mode=0644 ; project: /etc/motd mode=0600\n# after: keep one authoritative declaration\n[bootstrap.files.\"/etc/motd\"]\nmode = \"0644\"","handlingStrategy":"validation","validationCode":"merged = {}\nfor layer in layers:\n  for path, decl in layer.files.items():\n    if path in merged and merged[path] != decl:\n      raise SystemExit(f'conflicting managed file decl for {path}')\n    merged[path] = decl","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare each managed file in exactly one layer.","Keep file attributes (mode, content source) consistent across shared/global configs.","Diff bootstrap file maps between layers when adding overrides."],"tags":["config","managed-files","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"}