jdx/mise · error

--changed does not accept target arguments

Error message

--changed does not accept target arguments

What it means

`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.

Source

Thrown at src/cli/dotfiles/add.rs:94

    /// Source path to use for a single target
    #[usage(long, short, value_name = "PATH")]
    pub(super) source: Option<PathBuf>,

    /// Skip the confirmation prompt
    #[usage(long, short)]
    pub(super) yes: bool,
}

impl DotfilesAdd {
    /// Validate and capture the requested targets as one transactional update.
    pub(crate) async fn run(self) -> Result<()> {
        let mode = self.validate()?;
        OperationScope::wrap("bootstrap dotfiles add", self.dry_run, self.run_inner(mode)).await
    }

    fn validate(&self) -> Result<FileMode> {
        if self.changed && !self.targets.is_empty() {
            bail!("--changed does not accept target arguments");
        }
        if !self.changed && self.targets.is_empty() {
            bail!("at least one target or --changed is required");
        }
        if self.source.is_some() && self.targets.len() != 1 {
            bail!("--source can only be used with one target");
        }
        match self.mode.as_deref() {
            Some("track") => bail!(
                "`--mode track` tracks a file where it is and takes no source; use `mise bootstrap dotfiles track <path>`"
            ),
            Some(mode) => {
                FileMode::parse(mode).ok_or_else(|| eyre::eyre!("unknown dotfile mode: {mode}"))
            }
            None => Ok(system::files::default_mode()),
        }
    }

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Remove the positional targets when using --changed: `mise dotfiles add --changed`
  2. Drop --changed and list the explicit targets if you want to add specific files
  3. Wrap the choice in your script: pass either --changed or targets, never both

Example fix

// before
mise dotfiles add --changed ~/.zshrc
// after
mise dotfiles add --changed
// or
mise dotfiles add ~/.zshrc
Defensive patterns

Strategy: validation

Validate before calling

if [[ " $* " == *' --changed '* ]] && [[ $# -gt 1 ]]; then echo '--changed takes no targets'; exit 1; fi

Prevention

When it happens

Trigger: Running `mise dotfiles add --changed <target...>` — i.e. passing --changed AND one or more target paths.

Common situations: Scripted commands that always append targets even when --changed is set, or users switching from explicit targets to --changed without removing the old arguments.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/976460af3d126656. Report an issue: GitHub.