{"record":{"id":"bb96ed035bb7f050","repo":"jdx/mise","slug":"mode-track-tracks-a-file-where-it-is-and-takes-no-source-use","errorCode":null,"errorMessage":"`--mode track` tracks a file where it is and takes no source; use `mise dot track <path>`","messagePattern":"`--mode track` tracks a file where it is and takes no source; use `mise dot track <path>`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/add.rs","lineNumber":107,"sourceCode":"impl DotfilesAdd {\n    /// Validate and capture the requested targets as one transactional update.\n    pub(crate) async fn run(self) -> Result<()> {\n        let mode = self.validate()?;\n        OperationScope::wrap(\"bootstrap dotfiles add\", self.dry_run, self.run_inner(mode)).await\n    }\n\n    fn validate(&self) -> Result<FileMode> {\n        if self.changed && !self.targets.is_empty() {\n            bail!(\"--changed does not accept target arguments\");\n        }\n        if !self.changed && self.targets.is_empty() {\n            bail!(\"at least one target or --changed is required\");\n        }\n        if self.source.is_some() && self.targets.len() != 1 {\n            bail!(\"--source can only be used with one target\");\n        }\n        match self.mode.as_deref() {\n            Some(\"track\") => bail!(\n                \"`--mode track` tracks a file where it is and takes no source; use `mise dot track <path>`\"\n            ),\n            Some(mode) => {\n                FileMode::parse(mode).ok_or_else(|| eyre::eyre!(\"unknown dotfile mode: {mode}\"))\n            }\n            None => Ok(system::files::default_mode()),\n        }\n    }\n\n    async fn run_inner(mut self, mode: FileMode) -> Result<()> {\n        let config = Config::get().await?;\n        let secrets = system::secrets::resolve(&config, self.prompt_secrets)?;\n        let managed = system::files::files_from_config(&config)?;\n        if self.changed {\n            for req in &managed {\n                if req.mode == FileMode::Copy\n                    && req.target.is_file()\n                    && !req.target.is_symlink()","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/dotfiles/add.rs#L89-L125","documentation":"`--mode track` tells mise to track a dotfile where it currently lives, without moving or linking it, so it inherently cannot take a `--source`. validate() rejects `--mode track` combined with `--source` and points the user to the dedicated `mise dot track` command.","triggerScenarios":"Running `mise dotfiles add --mode track --source <path> <target>` — the mode string equals \"track\" in validate()'s match arm.","commonSituations":"Copy-pasting an add command and swapping the mode without removing --source; confusion between the `add --mode track` and `dot track` subcommands.","solutions":["Use `mise dot track <path>` instead, which is the dedicated command for tracking in place.","Or remove `--source` if the goal was `mise dotfiles add --mode track <path>`.","Use `--mode link` (or the default mode) with --source if you actually want a sourced/moved file."],"exampleFix":"// before\n$ mise dotfiles add --mode track --source ~/dotfiles/zshrc ~/.zshrc\n\n// after\n$ mise dot track ~/.zshrc","handlingStrategy":"validation","validationCode":"# guard: never combine --mode track with --source\nif [ \"$MODE\" = \"track\" ] && [ -n \"$SOURCE\" ]; then\n  echo \"--mode track takes no --source; use 'mise dot track <path>'\" >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the dedicated `mise dot track <path>` for in-place tracking.","Only pass --source with link/move-style modes.","Review mode flags when adapting existing add commands."],"tags":["dotfiles","cli","validation","flags"],"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"}