jdx/mise · error

at least one target or --changed is required

Error message

at least one target or --changed is required

What it means

`mise dotfiles add` requires something to operate on: either at least one target path or the `--changed` flag. When neither is provided, `validate` (called from run before any work) bails with 'at least one target or --changed is required'.

Source

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

    /// 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()),
        }
    }

    async fn run_inner(mut self, mode: FileMode) -> Result<()> {
        let config = Config::get().await?;
        let managed = system::files::files_from_config(&config)?;

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Pass the file(s) to add: `mise dotfiles add ~/.zshrc`
  2. Use `mise dotfiles add --changed` to add only changed dotfiles
  3. Check your script for empty/unexpanded target variables

Example fix

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

Strategy: validation

Validate before calling

shift 1; [ $# -gt 0 ] || [ "$CHANGED" = true ] || { echo 'need targets or --changed'; exit 1; }

Prevention

When it happens

Trigger: Running `mise dotfiles add` with no positional targets and without --changed.

Common situations: Invoking the bare subcommand to 'see what happens', shell scripts whose variable expansion of target paths yields an empty string, or forgetting --changed when intending to sync recently modified dotfiles.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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