{"record":{"id":"0035b542195ba082","repo":"jdx/mise","slug":"mode-track-tracks-a-file-where-it-is-and-takes","errorCode":null,"errorMessage":"`--mode track` tracks a file where it is and takes no source; use `mise bootstrap dotfiles track <path>`","messagePattern":"`--mode track` tracks a file where it is and takes no source; use `mise bootstrap dotfiles track <path>`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/add.rs","lineNumber":103,"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 bootstrap dotfiles 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 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()\n                    && !req.source.is_dir()","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/dotfiles/add.rs#L85-L121","documentation":"The dotfiles add command rejects `--mode track` because tracked-mode dotfiles are files kept in place at their real location, so they never have a source to copy from. The `add` subcommand only handles modes that copy or link from a source (e.g. copy, symlink), and track has its own dedicated `mise bootstrap dotfiles track <path>` subcommand. validate() bails immediately upon seeing mode \"track\" to redirect users to the correct command.","triggerScenarios":"Running `mise bootstrap dotfiles add <target> --mode track` (with or without --source). validate() is called from run_inner during argument parsing, before any filesystem work, so the command always fails fast with this exact message.","commonSituations":"Users who know `track` is a valid FileMode from config files assume it is also valid for the add subcommand's --mode flag; scripts migrated from config-based dotfiles setup; users trying to add a file that already exists in place without a managed source.","solutions":["Run `mise bootstrap dotfiles track <path>` instead of `mise bootstrap dotfiles add <path> --mode track`.","If you actually want a copied/linked dotfile, use a supported mode such as `--mode copy` or `--mode symlink` and provide a source.","Remove `--source` if it was supplied; track takes no source."],"exampleFix":"// before\nmise bootstrap dotfiles add ~/.zshrc --mode track\n// after\nmise bootstrap dotfiles track ~/.zshrc","handlingStrategy":"validation","validationCode":"const MODES_WITH_SOURCE = new Set(['copy', 'symlink']);\nif (mode === 'track') {\n  // route to the dedicated subcommand instead\n  throw new Error(\"use `mise bootstrap dotfiles track <path>` for track mode\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember `track` is only a FileMode in config and a separate subcommand — never an add --mode value.","Before scripting, check `mise bootstrap dotfiles add --help` for the supported --mode values."],"tags":["cli","dotfiles","invalid-mode","wrong-subcommand"],"backgroundTag":"invalid-cli-argument","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}