{"record":{"id":"976460af3d126656","repo":"jdx/mise","slug":"changed-does-not-accept-target-arguments","errorCode":null,"errorMessage":"--changed does not accept target arguments","messagePattern":"--changed does not accept target arguments","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/add.rs","lineNumber":94,"sourceCode":"    /// Source path to use for a single target\n    #[usage(long, short, value_name = \"PATH\")]\n    pub(super) source: Option<PathBuf>,\n\n    /// Skip the confirmation prompt\n    #[usage(long, short)]\n    pub(super) yes: bool,\n}\n\nimpl 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","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/dotfiles/add.rs#L76-L112","documentation":"`mise dotfiles add` supports two mutually exclusive modes: adding explicit target paths or, with `--changed`, operating on files that changed. The `validate` method rejects the combination of `--changed` together with positional target arguments because the targets would be ignored.","triggerScenarios":"Running `mise dotfiles add --changed <target...>` — i.e. passing --changed AND one or more target paths.","commonSituations":"Scripted commands that always append targets even when --changed is set, or users switching from explicit targets to --changed without removing the old arguments.","solutions":["Remove the positional targets when using --changed: `mise dotfiles add --changed`","Drop --changed and list the explicit targets if you want to add specific files","Wrap the choice in your script: pass either --changed or targets, never both"],"exampleFix":"// before\nmise dotfiles add --changed ~/.zshrc\n// after\nmise dotfiles add --changed\n// or\nmise dotfiles add ~/.zshrc","handlingStrategy":"validation","validationCode":"if [[ \" $* \" == *' --changed '* ]] && [[ $# -gt 1 ]]; then echo '--changed takes no targets'; exit 1; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick either --changed or explicit targets per invocation","In scripts, build the argument list conditionally","Test wrapper scripts with both modes"],"tags":["cli","dotfiles","flags"],"backgroundTag":"mutually-exclusive-flags","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"}