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` validation: the invocation passed neither any target paths nor --changed, so there is nothing to add and the command refuses to run an empty transaction rather than silently succeeding.

Solutions

  1. Pass at least one target: `mise dotfiles add ~/.zshrc`.
  2. Use `mise dotfiles add --changed` to add all detected differing files.
  3. If the path came from a variable, verify it is non-empty before invoking the command.

Example fix

// before
$ mise dotfiles add

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

Strategy: validation

Validate before calling

# shell-side guard: require at least one target or --changed
[ $# -eq 0 ] && [ -z "$CHANGED" ] && { echo "usage: dotfiles add [--changed] <target...>" >&2; exit 2; }

Prevention

When it happens

Trigger: Running `mise dotfiles add` with no positional targets and without `--changed` (changed == false && targets.is_empty()) in validate() called from run.

Common situations: Running the bare command to 'see what it does'; a script variable holding the target path expanding empty; forgetting --changed when intending to add all differing files.

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

Appendix: source

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

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

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

View on GitHub (pinned to 533346cc37)