{"record":{"id":"6004b93d73fdc385","repo":"jdx/mise","slug":"target-raw-tracked-in-place-pass-mode-copy","errorCode":null,"errorMessage":"{target_raw}: tracked in place; pass `--mode copy` after `mise bootstrap dotfiles untrack {target_raw}` to seed a source instead","messagePattern":"(.+?): tracked in place; pass `--mode copy` after `mise bootstrap dotfiles untrack (.+?)` to seed a source instead","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/add.rs","lineNumber":165,"sourceCode":"            cwd: None,\n            prefer_toml: true,\n            prevent_home_local: true,\n        })?;\n\n        let mut planned = vec![];\n        let managed_edits = system::edits::edits_from_config(&config)?;\n        for target_raw in &self.targets {\n            let target = system::files::resolve_target_arg(target_raw)\n                .components()\n                .collect::<PathBuf>();\n            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,","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/dotfiles/add.rs#L147-L183","documentation":"If the target already has a FileMode::Track requirement in the managed dotfile set, adding it as copy/symlink would conflict with the existing in-place tracking. run_inner detects the overlap and bails, telling the user to untrack the file first and then add it with `--mode copy` so a source copy can be seeded from the currently tracked file.","triggerScenarios":"Running `mise bootstrap dotfiles add <target>` (default or --mode copy/symlink) on a file that is already tracked via a previous `dotfiles track` or a [dotfiles] track entry. Also fired when the --source-only rename flow hits an already-tracked target.","commonSituations":"Migrating a file from track-based to copy-based management; re-running setup scripts that mix `track` and `add`; forgetting an earlier tracking entry exists in config.","solutions":["Run `mise bootstrap dotfiles untrack <target>` first, then add with `--mode copy` to seed a source.","Keep tracking the file and drop the add attempt if in-place tracking is what you want.","Check existing entries with the dotfiles list/show command to confirm the current mode."],"exampleFix":"# before\nmise bootstrap dotfiles add ~/.zshrc --mode copy\n# after\nmise bootstrap dotfiles untrack ~/.zshrc\nmise bootstrap dotfiles add ~/.zshrc --mode copy","handlingStrategy":"validation","validationCode":"// check current mode before switching\nconst list = execSync(`mise bootstrap dotfiles ls --json`).toString();\nconst managed = JSON.parse(list);\nif (managed.some(d => d.target === target && d.mode === 'track')) {\n  execSync(`mise bootstrap dotfiles untrack ${target}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  execSync(`mise bootstrap dotfiles add ${target} --mode copy`);\n} catch (e) {\n  if (String(e.stderr).includes('tracked in place')) {\n    execSync(`mise bootstrap dotfiles untrack ${target}`);\n    execSync(`mise bootstrap dotfiles add ${target} --mode copy`);\n  } else throw e;\n}","preventionTips":["List current dotfile entries before changing a file's management mode.","Standardize on one management style (track vs copy) per file to avoid mode conflicts."],"tags":["cli","dotfiles","conflict","invalid-state"],"backgroundTag":"invalid-state-transition","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"}