Morganamilo/paru · error · anyhow::Error
{pacman stderr}
Error message
{pacman stderr} What it means
set_install_reason runs `pacman -D --asdeps/--asexplicit` to mark installed packages and, when the command fails, surfaces pacman's stderr verbatim as the error. The message content is whatever pacman printed, e.g. 'error: target not found: <pkg>'.
Solutions
- Read the stderr text in the error: it names the exact pacman failure (usually 'target not found')
- Ensure the packages exist in the local pacman database before using --asdeps/--asexp
- Re-run after resolving pacman db locks or syncing: sudo pacman -D --asdeps <pkg> directly to see full output
Defensive patterns
Strategy: try-catch
Validate before calling
// check the package exists in the local db before --asdeps pacman -Qi "$pkg" >/dev/null 2>&1 || echo "not installed: $pkg"
Try / catch
match set_install_reason(config, reason, pkgs) {
Err(e) => eprintln!("pacman -D failed: {}", e), // stderr text names the target
Ok(()) => {}
} Prevention
- Confirm packages are installed via pacman before changing install reason
- Run pacman -D directly to see full stderr when in doubt
- Avoid concurrent pacman operations that could remove targets mid-run
When it happens
Trigger: paru -S --asdeps (or --asexp) on packages, and exec::pacman_output returns a non-success status for `pacman -D database` (e.g. target package not installed or not owned by pacman).
Common situations: Marking packages as deps when a package was removed concurrently or installed outside pacman; permission/db lock issues also surface here via stderr.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- no local repo named
- no local repos configured, add one to your pacman.conf: …
- can not find local repo
- value can not be empty for key
- key ' ' does not belong to a section
AI-assisted analysis of Morganamilo/paru@9ac3578807 (2026-09-12).
Data as JSON: /api/errors/53e73adbd8d0125c.
Report an issue: GitHub.
Appendix: source
Thrown at src/install.rs:1560
}
fn set_install_reason<S: AsRef<str>>(config: &Config, reason: &str, pkgs: &[S]) -> Result<()> {
let alpm = config.new_alpm()?;
let db = alpm.localdb();
let pkgs = pkgs
.iter()
.map(|s| s.as_ref())
.filter(|p| db.pkg(*p).is_ok());
let mut args = config.pacman_globals();
args.op("database").arg(reason).targets(pkgs);
if args.targets.is_empty() {
return Ok(());
}
let output = exec::pacman_output(config, &args)?;
ensure!(
output.status.success(),
"{}",
String::from_utf8_lossy(&output.stderr)
);
Ok(())
}
fn pre_build_command(config: &Config, dir: &Path, base: &str, version: &str) -> Result<()> {
if let Some(ref pb_cmd) = config.pre_build_command {
let mut cmd = Command::new("sh");
cmd.env("PKGBASE", base)
.env("VERSION", version)
.current_dir(dir)
.arg("-c")
.arg(pb_cmd);
exec::command(&mut cmd)?;
}
Ok(())View on GitHub (pinned to 9ac3578807)