{"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":98,"sourceCode":"    /// Skip the confirmation prompt\n    #[usage(long, short)]\n    pub(super) yes: bool,\n\n    /// Prompt securely for missing bootstrap secret inputs\n    #[usage(long)]\n    pub(super) prompt_secrets: 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 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","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/dotfiles/add.rs#L80-L116","documentation":"`mise dotfiles add` supports two mutually exclusive modes of choosing what to add: explicit target paths or `--changed` (all files detected as differing). validate() rejects the combination of `--changed` with positional target arguments because the intent is ambiguous.","triggerScenarios":"Running `mise dotfiles add --changed <path...>` — i.e. the `changed` flag is true and `targets` is non-empty — during validate() called from run.","commonSituations":"Scripting the add command and appending both the flag and explicit paths; forgetting that --changed already implies the target set; shell aliases that always inject a path argument.","solutions":["Drop the target arguments and use only `mise dotfiles add --changed`.","Or drop `--changed` and pass the explicit target paths.","If you intended only some changed files, run `--changed` first and then manage/remove unwanted entries individually."],"exampleFix":"// before\n$ mise dotfiles add --changed ~/.zshrc\n\n// after\n$ mise dotfiles add --changed\n# or\n$ mise dotfiles add ~/.zshrc","handlingStrategy":"validation","validationCode":"# shell-side guard before invoking\nif [ \"$USE_CHANGED\" = \"1\" ] && [ $# -gt 0 ]; then\n  echo \"either pass targets or --changed, not both\" >&2; exit 2\nfi\nmise dotfiles add ${USE_CHANGED:+--changed} \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Choose one selection mode per invocation: targets OR --changed.","Avoid aliases/wrappers that silently append path arguments.","Document --changed as an exclusive flag in team scripts."],"tags":["dotfiles","cli","validation","flags"],"backgroundTag":"mutually-exclusive-flags","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"}