Morganamilo/paru · error · anyhow::Error
can't find package name in packagelist
Error message
can't find package name in packagelist: {} What it means
parse_package_list takes makepkg output lines that should be paths to built package files of the form pkgname-pkgver-pkgrel-arch.pkgext. It strips the directory, splits on '-', and requires at least 4 segments; fewer means the line is not a package filename, so the package name can't be extracted.
Solutions
- Check the built files in the PKGBUILD directory: the filename must be pkgname-pkgver-pkgrel-arch.pkgext
- Fix the PKGBUILD's pkgname/pkgver/pkgrel/arch so makepkg emits a conventional 4-part filename
- Inspect makepkg's raw output for non-package lines and remove anything that alters the parsed list (e.g. custom PKGEXT/commands echoing extra text)
Example fix
// before (PKGBUILD) pkgver=1.0 pkgrel= // after (empty pkgrel produced malformed filename) pkgver=1.0 pkgrel=1
Defensive patterns
Strategy: validation
Validate before calling
// require basename to have pkgname-pkgver-pkgrel-arch shape
let file = line.rsplit('/').next().unwrap();
let split: Vec<&str> = file.split('-').collect();
if split.len() < 4 { eprintln!("unexpected package filename: {}", line); } Prevention
- Keep pkgver/pkgrel/arch conventional in PKGBUILDs
- Avoid custom PKGEXT/naming that breaks pkgname-pkgver-pkgrel-arch.pkgext
- Review makepkg output for stray non-package lines
When it happens
Trigger: After build_pkgbuild/build_install_pkgbuild runs makepkg, an output line's basename splits into fewer than 4 '-'-separated parts — e.g. the file name contains unexpected formatting or the output line isn't a package path at all.
Common situations: PKGBUILD producing package files whose pkgname/pkgver contain characters that break the assumed split; custom PKGEXT or unusual naming; makepkg printing non-package lines that slip into the parsed output; package names containing hyphens are fine (rsplit takes fields from the right, but very short names like 'a-b-x.pkg.tar.zst' fall under 4 parts).
Related errors
- failed to parse srcinfo
- duplicate PKGBUILD
- {}: {}
- packages failed to build
- package list does not match srcinfo
AI-assisted analysis of Morganamilo/paru@9ac3578807 (2026-09-12).
Data as JSON: /api/errors/a53406c652495e3b.
Report an issue: GitHub.
Appendix: source
Thrown at src/install.rs:2067
args.arg("d");
}
}
fn parse_package_list(
config: &Config,
dir: &Path,
pkgdest: Option<&str>,
) -> Result<(HashMap<String, String>, String)> {
let output = exec::makepkg_output_dest(config, dir, &["--packagelist"], pkgdest)?;
let output = String::from_utf8(output.stdout).context("pkgdest is not utf8")?;
let mut pkgdests = HashMap::new();
let mut version = String::new();
for line in output.trim().lines() {
let file = line.rsplit('/').next().unwrap();
let split = file.split('-').collect::<Vec<_>>();
ensure!(
split.len() >= 4,
"{}",
tr!("can't find package name in packagelist: {}", line)
);
// pkgname-pkgver-pkgrel-arch.pkgext
// This assumes 3 dashes after the pkgname, Will cause an error
// if the PKGEXT contains a dash. Please no one do that.
let pkgname = split[..split.len() - 3].join("-");
version = split[split.len() - 3..split.len() - 1].join("-");
pkgdests.insert(pkgname, line.to_string());
}
Ok((pkgdests, version))
}
fn needs_build(
config: &Config,View on GitHub (pinned to 9ac3578807)