{"record":{"id":"3be7b06231a8a41c","repo":"Morganamilo/paru","slug":"no-targets-specified-use-h-for-help","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/install.rs","lineNumber":911,"sourceCode":"            self.do_install(config)?;\n        }\n\n        Ok(())\n    }\n\n    pub async fn install(&mut self, config: &mut Config, targets_str: &[String]) -> Result<()> {\n        self.sudo_loop(config)?;\n        self.news(config).await?;\n\n        config.set_op_args_globals(Op::Sync);\n        config.targets = targets_str.to_vec();\n        config.args.targets = config.targets.clone();\n\n        let targets = args::parse_targets(targets_str);\n        let (mut repo_targets, aur_targets) = split_repo_aur_targets(config, &targets)?;\n\n        if targets_str.is_empty() && self.sysupgrade == 0 && !self.sysupgrade == 0 {\n            bail!(tr!(\"no targets specified (use -h for help)\"));\n        }\n\n        if config.mode.repo() {\n            if config.combined_upgrade {\n                if config.args.has_arg(\"y\", \"refresh\") {\n                    self.early_refresh(config)?;\n                }\n            } else if !config.chroot\n                && (config.args.has_arg(\"y\", \"refresh\")\n                    || config.args.has_arg(\"u\", \"sysupgrade\")\n                    || !repo_targets.is_empty()\n                    || config.mode == Mode::REPO)\n            {\n                let targets = repo_targets.iter().map(|t| t.to_string()).collect();\n                repo_targets.clear();\n                self.done_something = true;\n                self.ran_pacman = true;\n                self.early_pacman(config, targets)?;","sourceCodeStart":893,"sourceCodeEnd":929,"githubUrl":"https://github.com/Morganamilo/paru/blob/9ac3578807a87858651e81a02586ceb947686e7c/src/install.rs#L893-L929","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Pass at least one package target, e.g. `paru -S ripgrep`","If you meant to upgrade, add `-u` (`paru -Syu`) so sysupgrade != 0","Check shell scripts for unset/empty variables holding the package list","Run `paru -h` to see valid operation/flag combinations"],"exampleFix":"// before: command with empty target\n$ paru -S $PKGS        # PKGS is unset -> error\n// after: guard in script\n$ [ -n \"$PKGS\" ] && paru -S $PKGS || paru -Syu","handlingStrategy":"validation","validationCode":"if targets_str.is_empty() && !wants_upgrade(args) {\n    eprintln!(\"provide package targets or add -u to upgrade\");\n    std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass explicit package names to -S in scripts","Use -Syu when the intent is an upgrade, not -S","Quote/default shell variables: paru -S \"${PKGS:?PKGS must be set}\""],"tags":["cli","missing-argument","pacman","aur"],"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"}