Morganamilo/paru · error

no targets specified (use -h for help)

Error message

no targets specified (use -h for help)

What it means

This error is thrown by paru's install operation when the user requested a sync/install-style command but provided no package targets and no upgrade-triggering flags. The condition explicitly requires targets_str to be empty and sysupgrade to be 0 (both branches), meaning the command would be a no-op. paru aborts early rather than doing nothing silently, directing the user to -h for usage.

Solutions

  1. Pass at least one package target, e.g. `paru -S ripgrep`
  2. If you meant to upgrade, add `-u` (`paru -Syu`) so sysupgrade != 0
  3. Check shell scripts for unset/empty variables holding the package list
  4. Run `paru -h` to see valid operation/flag combinations

Example fix

// before: command with empty target
$ paru -S $PKGS        # PKGS is unset -> error
// after: guard in script
$ [ -n "$PKGS" ] && paru -S $PKGS || paru -Syu
Defensive patterns

Strategy: validation

Validate before calling

if targets_str.is_empty() && !wants_upgrade(args) {
    eprintln!("provide package targets or add -u to upgrade");
    std::process::exit(1);
}

Prevention

When it happens

Trigger: Running a command like `paru -S` with no package names, while neither `--sysupgrade`/`-u` (sysupgrade == 1) nor its negation is set. Any install() invocation where args::parse_targets(targets_str) yields an empty target list and self.sysupgrade == 0.

Common situations: Typing `paru -S` or `paru -Ss`-like partial commands with the target forgotten; scripting paru with a variable that expands empty (e.g. `paru -S $PKGS` with PKGS unset); wrapping paru in a script that strips args; confusion between -S (install) and -Su (upgrade).

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 Morganamilo/paru@9ac3578807 (2026-09-12). Data as JSON: /api/errors/3be7b06231a8a41c. Report an issue: GitHub.

Appendix: source

Thrown at src/install.rs:911

            self.do_install(config)?;
        }

        Ok(())
    }

    pub async fn install(&mut self, config: &mut Config, targets_str: &[String]) -> Result<()> {
        self.sudo_loop(config)?;
        self.news(config).await?;

        config.set_op_args_globals(Op::Sync);
        config.targets = targets_str.to_vec();
        config.args.targets = config.targets.clone();

        let targets = args::parse_targets(targets_str);
        let (mut repo_targets, aur_targets) = split_repo_aur_targets(config, &targets)?;

        if targets_str.is_empty() && self.sysupgrade == 0 && !self.sysupgrade == 0 {
            bail!(tr!("no targets specified (use -h for help)"));
        }

        if config.mode.repo() {
            if config.combined_upgrade {
                if config.args.has_arg("y", "refresh") {
                    self.early_refresh(config)?;
                }
            } else if !config.chroot
                && (config.args.has_arg("y", "refresh")
                    || config.args.has_arg("u", "sysupgrade")
                    || !repo_targets.is_empty()
                    || config.mode == Mode::REPO)
            {
                let targets = repo_targets.iter().map(|t| t.to_string()).collect();
                repo_targets.clear();
                self.done_something = true;
                self.ran_pacman = true;
                self.early_pacman(config, targets)?;

View on GitHub (pinned to 9ac3578807)