Morganamilo/paru · error · anyhow::Error
failed to parse srcinfo
Error message
failed to parse srcinfo "{}" What it means
read_pkg parses a .SRCINFO file with the srcinfo crate; on failure it wraps the parser error with context naming the srcinfo path. The message means the SRCINFO on disk is malformed or unreadable for the pkgbuild being processed.
Solutions
- Regenerate the .SRCINFO: run `makepkg --printsrcinfo > .SRCINFO` in the pkgbuild directory.
- Inspect the wrapped srcinfo error in the message to find the exact invalid line and fix it.
- Verify required fields (pkgbase/pkgname, pkgver, pkgrel) are present and well-formed.
- If the file is truncated, re-download/re-clone the pkgbuild source.
Example fix
# before: fix the malformed .SRCINFO by regenerating cd ~/.cache/paru/clone/mypkg makepkg --printsrcinfo > .SRCINFO # verify paru -G mypkg
Defensive patterns
Strategy: validation
Validate before calling
let path = Path::new(dir).join(".SRCINFO");
let text = std::fs::read_to_string(&path)?;
if !text.contains("pkgbase") || !text.contains("pkgname") {
panic!("{} missing required pkgbase/pkgname", path.display());
} Try / catch
// handle parse failure per-package without aborting the batch
match read_pkgs(config, repos) {
Ok(pkgs) => pkgs,
Err(e) => {
eprintln!("{e:#}; regenerate with: makepkg --printsrcinfo > .SRCINFO");
Vec::new(),
}
} Prevention
- Regenerate .SRCINFO after any PKGBUILD edit.
- Never hand-edit .SRCINFO files.
- Interrupted builds: delete and re-clone the package directory.
When it happens
Trigger: Calling read_pkg (via read_pkgs) on a repository/pkgbuild directory whose .SRCINFO fails srcinfo parsing — missing pkgbase/pkgname fields, bad field syntax, or truncated file.
Common situations: A partially-written .SRCINFO from an interrupted makepkg/pkgbuild run; hand-edited .SRCINFO with invalid keys; cloning a local repo whose .SRCINFO generation (makepkg --printsrcinfo) failed earlier.
Understand the failure class
Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- can't find package name in packagelist
- duplicate PKGBUILD
- could not find .SRCINFO for
- package list does not match srcinfo
- repo does not have a URL or Path
AI-assisted analysis of Morganamilo/paru@9ac3578807 (2026-09-12).
Data as JSON: /api/errors/a3aafeb2b40c01cc.
Report an issue: GitHub.
Appendix: source
Thrown at src/pkgbuild.rs:277
Ok(())
}
fn read_pkg(&self, config: &Config, path: &Path) -> Result<PkgbuildPkg> {
let srcinfo_path = path.join(".SRCINFO");
if !srcinfo_path.exists() {
self.generate_srcinfo(config, path)?;
}
let srcinfo = Srcinfo::from_path(&srcinfo_path);
match srcinfo {
Ok(srcinfo) => Ok(PkgbuildPkg {
repo: self.name.to_string(),
srcinfo,
path: path.to_path_buf(),
}),
Err(err) => Err(anyhow!(err).context(tr!(
"failed to parse srcinfo \"{}\"",
srcinfo_path.display().to_string()
))),
}
}
}
#[derive(Debug, Clone)]
pub struct PkgbuildRepos {
pub fetch: Fetch,
pub repos: Vec<PkgbuildRepo>,
}
impl PkgbuildRepos {
pub fn new(fetch: Fetch) -> Self {
Self {
fetch,
repos: Vec::new(),View on GitHub (pinned to 9ac3578807)