{"record":{"id":"ec0fa3ee630777f7","repo":"Morganamilo/paru","slug":"no-targets-specified-use-h-for-help-lib","errorCode":null,"errorMessage":"no targets specified (use -h for help)","messagePattern":"no targets specified \\(use -h for help\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib.rs","lineNumber":240,"sourceCode":"        // _ => bail!(\"unknown op '{}'\", config.op),\n    };\n\n    Ok(ret)\n}\n\nasync fn handle_upgrade(config: &mut Config) -> Result<i32> {\n    if config.targets.is_empty() {\n        let dir = current_dir()?;\n        install::build_dirs(config, vec![dir]).await?;\n        Ok(0)\n    } else {\n        Ok(exec::pacman(config, &config.args)?.code())\n    }\n}\n\nasync fn handle_build(config: &mut Config) -> Result<i32> {\n    if config.targets.is_empty() {\n        bail!(tr!(\"no targets specified (use -h for help)\"));\n    } else {\n        let dirs = config.targets.iter().map(PathBuf::from).collect();\n        install::build_dirs(config, dirs).await?;\n    }\n    Ok(0)\n}\n\nasync fn handle_query(config: &mut Config) -> Result<i32> {\n    let args = &config.args;\n    if args.has_arg(\"s\", \"search\") && config.interactive {\n        let stdout = redirect_to_stderr()?;\n        interactive_search_local(config)?;\n        reopen_stdout(&stdout)?;\n        for pkg in &config.targets {\n            print_target(pkg, config.quiet);\n        }\n        Ok(0)\n    } else if args.has_arg(\"u\", \"upgrades\") {","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/Morganamilo/paru/blob/9ac3578807a87858651e81a02586ceb947686e7c/src/lib.rs#L222-L258","documentation":"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.","triggerScenarios":"Invoking the build operation (handle_build from handle_cmd) with zero positional targets — e.g. `paru -B` with no directory arguments.","commonSituations":"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.","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"],"exampleFix":"// before\n$ paru -B\nno targets specified (use -h for help)\n// after\n$ paru -B ~/build/myrepo","handlingStrategy":"validation","validationCode":"if build_dirs.is_empty() {\n    eprintln!(\"paru -B needs at least one directory containing a PKGBUILD\");\n    std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass explicit directory targets to -B","Default script args: paru -B \"${DIRS:-.}\"","Confirm the target dir actually contains a PKGBUILD"],"tags":["cli","missing-argument","build"],"backgroundTag":"missing-required-argument","analyzedSha":"9ac3578807a87858651e81a02586ceb947686e7c","analyzedAt":"2026-09-12T04:57:59.861Z","contentChangedAt":"2026-09-12T04:57:59.861Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}