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

Solutions

  1. Drop the target arguments and use only `mise dotfiles add --changed`.
  2. Or drop `--changed` and pass the explicit target paths.
  3. If you intended only some changed files, run `--changed` first and then manage/remove unwanted entries individually.

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

# shell-side guard before invoking
if [ "$USE_CHANGED" = "1" ] && [ $# -gt 0 ]; then
  echo "either pass targets or --changed, not both" >&2; exit 2
fi
mise dotfiles add ${USE_CHANGED:+--changed} "$@"

Prevention

When it happens

Trigger: Running `mise dotfiles add --changed <path...>` — i.e. the `changed` flag is true and `targets` is non-empty — during validate() called from run.

Common situations: 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.

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@533346cc37 (2026-09-17). Data as JSON: /api/errors/976460af3d126656. Report an issue: GitHub.

Appendix: source

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

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

    /// Prompt securely for missing bootstrap secret inputs
    #[usage(long)]
    pub(super) prompt_secrets: 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 dot 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 533346cc37)