{"record":{"id":"429db438ab7a5f0c","repo":"jdx/mise","slug":"conflicting-dotfile-edit-declarations-for","errorCode":null,"errorMessage":"conflicting dotfile edit declarations for {}/{}\n\n  first:\n    {}\n\n  second:\n    {}","messagePattern":"conflicting dotfile edit declarations for (.+?)/(.+?)\n\n  first:\n    (.+?)\n\n  second:\n    (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/edits.rs","lineNumber":172,"sourceCode":"                    let resolved = crate::system::files::resolve_target_arg(filter);\n                    resolved == req.path\n                }\n        })\n}\n\n/// Aggregate edit `[dotfiles]` entries across all loaded config files. Entries\n/// union global -> local, keyed by `(path, id)`; a more local config overrides\n/// an edit with the same id. Malformed entries warn and are skipped.\npub(crate) fn edits_from_config(config: &Config) -> Result<Vec<EditRequest>> {\n    let mut composed: IndexMap<String, EditRequest> = IndexMap::new();\n    for config_files in config.bootstrap_config_maps() {\n        for request in edits_from_config_files(config_files) {\n            let key = format!(\"{}\\u{0}{}\", request.path.display(), request.id);\n            if let Some(existing) = composed.get(&key) {\n                if edit_requests_match(config, existing, &request) {\n                    continue;\n                }\n                bail!(\n                    \"conflicting dotfile edit declarations for {}/{}\\n\\n  first:\\n    {}\\n\\n  second:\\n    {}\",\n                    request.path.display(),\n                    request.id,\n                    existing.origin.conflict_description(),\n                    request.origin.conflict_description(),\n                );\n            }\n            composed.insert(key, request);\n        }\n    }\n    Ok(composed.into_values().collect())\n}\n\n/// Returns whether sibling declarations produce the same file edit.\nfn edit_requests_match(config: &Config, first: &EditRequest, second: &EditRequest) -> bool {\n    first.path == second.path\n        && first.id == second.id\n        && first.op == second.op","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/edits.rs#L154-L190","documentation":"Raised while composing dotfile edit requests from all config files: two config files declare an edit with the same (path, id) key but non-matching definitions. The library refuses to guess which wins and reports both declarations' conflict descriptions.","triggerScenarios":"Calling `edits_from_config` where `edits_from_config_files` yields two `EditRequest`s with identical `path` and `id` whose `edit_requests_match` comparison fails, and the message names the path/id plus the `origin.conflict_description()` of each.","commonSituations":"The same dotfile edit declared in both a global config (~/.config/mise/config.toml) and a project config with different content/replacement text; duplicated [[edit]] blocks after copy-pasting config between files; an id reused across two files for different edits to the same file.","solutions":["Open the two config files named in the message and make the duplicate declarations identical, or delete one.","Give one of the conflicting edits a different `id` so each (path, id) pair is unique.","Move shared edits to a single config file so they are declared exactly once."],"exampleFix":"# before (project config conflicts with global config)\n[[edits]]\npath = \"~/.zshrc\"\nid = \"alias\"\ncontent = \"alias g=git\"\n# after: change the id in one file, or remove the duplicate block","handlingStrategy":"validation","validationCode":"use std::collections::HashMap;\nlet mut seen: HashMap<(String, String), String> = HashMap::new();\nfor e in all_edit_entries() {\n    let key = (e.path.clone(), e.id.clone());\n    if let Some(prev) = seen.get(&key) { panic!(\"duplicate edit {key:?} in {prev}\"); }\n    seen.insert(key, e.config_file.clone());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare each (path, id) edit in exactly one config file.","Keep edits centralized in the global config; avoid copy-pasting [[edit]] blocks between projects.","Search all config files for a shared id before reusing it."],"tags":["dotfiles","config-conflict","duplicate"],"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"}