{"record":{"id":"a53406c652495e3b","repo":"Morganamilo/paru","slug":"can-t-find-package-name-in-packagelist","errorCode":null,"errorMessage":"can't find package name in packagelist: {}","messagePattern":"can't find package name in packagelist: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/install.rs","lineNumber":2067,"sourceCode":"        args.arg(\"d\");\n    }\n}\n\nfn parse_package_list(\n    config: &Config,\n    dir: &Path,\n    pkgdest: Option<&str>,\n) -> Result<(HashMap<String, String>, String)> {\n    let output = exec::makepkg_output_dest(config, dir, &[\"--packagelist\"], pkgdest)?;\n    let output = String::from_utf8(output.stdout).context(\"pkgdest is not utf8\")?;\n    let mut pkgdests = HashMap::new();\n    let mut version = String::new();\n\n    for line in output.trim().lines() {\n        let file = line.rsplit('/').next().unwrap();\n\n        let split = file.split('-').collect::<Vec<_>>();\n        ensure!(\n            split.len() >= 4,\n            \"{}\",\n            tr!(\"can't find package name in packagelist: {}\", line)\n        );\n\n        // pkgname-pkgver-pkgrel-arch.pkgext\n        // This assumes 3 dashes after the pkgname, Will cause an error\n        // if the PKGEXT contains a dash. Please no one do that.\n        let pkgname = split[..split.len() - 3].join(\"-\");\n        version = split[split.len() - 3..split.len() - 1].join(\"-\");\n        pkgdests.insert(pkgname, line.to_string());\n    }\n\n    Ok((pkgdests, version))\n}\n\nfn needs_build(\n    config: &Config,","sourceCodeStart":2049,"sourceCodeEnd":2085,"githubUrl":"https://github.com/Morganamilo/paru/blob/9ac3578807a87858651e81a02586ceb947686e7c/src/install.rs#L2049-L2085","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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)"],"exampleFix":"// before (PKGBUILD)\npkgver=1.0\npkgrel=\n// after (empty pkgrel produced malformed filename)\npkgver=1.0\npkgrel=1","handlingStrategy":"validation","validationCode":"// require basename to have pkgname-pkgver-pkgrel-arch shape\nlet file = line.rsplit('/').next().unwrap();\nlet split: Vec<&str> = file.split('-').collect();\nif split.len() < 4 { eprintln!(\"unexpected package filename: {}\", line); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["makepkg","parsing","pkgbuild"],"backgroundTag":"unexpected-response-shape","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"}