Morganamilo/paru · error
no targets specified (use -h for help)
Error message
no targets specified (use -h for help)
What it means
handle_build (the Op::Build path, i.e. `paru -B`-style building of local directories) requires at least one directory target. When config.targets is empty, the operation would do nothing, so paru bails with the same 'no targets specified' message used by pacman-style commands.
Solutions
- Pass the directory path(s) containing PKGBUILDs: `paru -B /path/to/pkgdir`
- cd into the PKGBUILD directory and run `paru -B .`
- Use `paru -S <pkgname>` instead if you meant to install from repos/AUR
- Check wrapper scripts for unset variables holding the directory list
Example fix
// before $ paru -B no targets specified (use -h for help) // after $ paru -B ~/build/myrepo
Defensive patterns
Strategy: validation
Validate before calling
if build_dirs.is_empty() {
eprintln!("paru -B needs at least one directory containing a PKGBUILD");
std::process::exit(1);
} Prevention
- Always pass explicit directory targets to -B
- Default script args: paru -B "${DIRS:-.}"
- Confirm the target dir actually contains a PKGBUILD
When it happens
Trigger: Invoking the build operation (handle_build from handle_cmd) with zero positional targets — e.g. `paru -B` with no directory arguments.
Common situations: Forgetting the directory containing PKGBUILD(s) after -B; script variables expanding empty; mistaking `-B` for `-S` and omitting paths; running `paru -B .` from a directory without a PKGBUILD thinking targets means packages.
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
- no targets specified (use -h for help)
- no operation specified (use -h for help)
- option expects a value
- unknown option
- unknown option
AI-assisted analysis of Morganamilo/paru@9ac3578807 (2026-09-12).
Data as JSON: /api/errors/ec0fa3ee630777f7.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib.rs:240
// _ => bail!("unknown op '{}'", config.op),
};
Ok(ret)
}
async fn handle_upgrade(config: &mut Config) -> Result<i32> {
if config.targets.is_empty() {
let dir = current_dir()?;
install::build_dirs(config, vec![dir]).await?;
Ok(0)
} else {
Ok(exec::pacman(config, &config.args)?.code())
}
}
async fn handle_build(config: &mut Config) -> Result<i32> {
if config.targets.is_empty() {
bail!(tr!("no targets specified (use -h for help)"));
} else {
let dirs = config.targets.iter().map(PathBuf::from).collect();
install::build_dirs(config, dirs).await?;
}
Ok(0)
}
async fn handle_query(config: &mut Config) -> Result<i32> {
let args = &config.args;
if args.has_arg("s", "search") && config.interactive {
let stdout = redirect_to_stderr()?;
interactive_search_local(config)?;
reopen_stdout(&stdout)?;
for pkg in &config.targets {
print_target(pkg, config.quiet);
}
Ok(0)
} else if args.has_arg("u", "upgrades") {View on GitHub (pinned to 9ac3578807)