{"record":{"id":"b3731312022aabea","repo":"jdx/mise","slug":"target-raw-target-is-already-managed-by-dotfil","errorCode":null,"errorMessage":"{target_raw}: target is already managed by [dotfiles] edits; remove or rename those entries before adding a whole-file dotfile","messagePattern":"(.+?): target is already managed by \\[dotfiles\\] edits; remove or rename those entries before adding a whole-file dotfile","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/add.rs","lineNumber":176,"sourceCode":"            if target.is_relative() {\n                bail!(\"{target_raw}: target must be absolute or start with ~/\");\n            }\n            if managed\n                .iter()\n                .any(|req| req.mode == FileMode::Track && req.target == target)\n            {\n                bail!(\n                    \"{target_raw}: tracked in place; pass `--mode copy` after `mise bootstrap dotfiles untrack {target_raw}` to seed a source instead\"\n                );\n            }\n            if managed_edits.iter().any(|req| {\n                system::files::matches_target(\n                    &req.path,\n                    &req.path_raw,\n                    std::slice::from_ref(target_raw),\n                )\n            }) {\n                bail!(\n                    \"{target_raw}: target is already managed by [dotfiles] edits; remove or rename those entries before adding a whole-file dotfile\"\n                );\n            }\n            let existing = managed.iter().find(|req| {\n                system::files::matches_target(\n                    &req.target,\n                    &req.target_raw,\n                    std::slice::from_ref(target_raw),\n                )\n            });\n            let source = if let Some(req) = existing {\n                req.source.clone()\n            } else if let Some(source) = &self.source {\n                file::replace_path(source)\n            } else {\n                system::files::implied_source(&target)?\n            };\n            let write_mode = existing.map(|req| req.mode).unwrap_or(mode);","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/dotfiles/add.rs#L158-L194","documentation":"A target already covered by a `[dotfiles] edits` entry (line/section edits within a file) cannot additionally be added as a whole-file dotfile — the two mechanisms would fight over the same file. run_inner checks edits_from_config with matches_target and bails if any edit requirement matches the new target, instructing the user to remove or rename those edit entries first.","triggerScenarios":"Running `mise bootstrap dotfiles add <target>` when the config's [dotfiles] edits section already contains an entry whose path/path_raw matches the target. Note the matching uses raw target strings as well, so a differently-spelled path can still collide.","commonSituations":"Users who manage a file with targeted edits deciding to manage the whole file; consolidating dotfile configs; inherited config files containing edits for the same dotfile.","solutions":["Remove the matching entry from the [dotfiles] edits section of your config, then re-run add.","Rename/narrow the edit entry's path so it no longer matches the whole-file target, if both behaviors are intended for different files.","Manage the file solely through [dotfiles] edits instead of adding it as a whole-file dotfile."],"exampleFix":"# before (mise.toml)\n[dotfiles.edits]\n\"~/.zshrc\" = { ... }\n# after — remove or rename the edits entry, then:\nmise bootstrap dotfiles add ~/.zshrc","handlingStrategy":"validation","validationCode":"// scan config for [dotfiles] edits covering the target before adding\nimport { readFileSync } from 'node:fs';\nconst cfg = readFileSync('mise.toml', 'utf8');\nif (/\\[dotfiles[.a-z]*edits/i.test(cfg)) {\n  console.warn('config has [dotfiles] edits — remove matching entries first');\n}","typeGuard":null,"tryCatchPattern":"try {\n  execSync(`mise bootstrap dotfiles add ${target}`);\n} catch (e) {\n  if (String(e.stderr).includes('already managed by [dotfiles] edits')) {\n    console.error('Remove/rename the [dotfiles] edits entry in mise.toml, then retry.');\n  } else throw e;\n}","preventionTips":["Choose per file whether it is managed by whole-file add or by [dotfiles] edits — never both.","Grep your mise config for the target path before running add."],"tags":["cli","dotfiles","conflict","config-error"],"backgroundTag":"conflicting-config-options","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}