Jguer/yay · error

: parse .SRCINFO

Error message

%s %s: parse .SRCINFO: %w

What it means

Wraps `gosrc.ParseFile` failures when parsing `.SRCINFO` from an AUR package's build directory to populate the pre-install/post-download event data. A malformed or missing .SRCINFO prevents building the event payload.

Solutions

  1. Remove the package's build directory in the cache and rerun so makepkg regenerates a fresh .SRCINFO.
  2. If you edited .SRCINFO manually, restore it from the AUR repository (`git checkout -- .SRCINFO` in the build dir).
  3. Read the wrapped cause for the exact parse line/column and fix the syntax.
Defensive patterns

Strategy: fallback

Validate before calling

if _, err := os.Stat(filepath.Join(dir, ".SRCINFO")); err != nil {
    // regenerate by re-cloning or running makepkg --printsrcinfo > .SRCINFO
}

Try / catch

srcinfo, err := gosrc.ParseFile(srcinfoPath)
if err != nil {
    return fmt.Errorf("invalid .SRCINFO for %s: %w", base, err)
}

Prevention

When it happens

Trigger: `aurPackageEvent` calls `gosrc.ParseFile(srcinfoPath)` on `<dir>/.SRCINFO`; the file is absent (regenerated only after makepkg runs), has invalid syntax, or was truncated.

Common situations: Stale build directories where .SRCINFO was deleted or never generated, hand-edited .SRCINFO with invalid keys, partial writes from a crashed previous build.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Jguer/yay@328f4b4939 (2026-09-07). Data as JSON: /api/errors/b415d5e224b74725. Report an issue: GitHub.

Appendix: source

Thrown at pkg/sync/workdir/aur_preinstall.go:107

) (settingslua.AURPreInstallEvent, error) {
	return aurPackageEvent(settingslua.EventAURPreInstall, base, path, packages, installed, targets)
}

func aurPackageEvent(eventName, base, path string, packages []settingslua.AURPreInstallPackage,
	installed mapset.Set[string], targets []map[string]*dep.InstallInfo,
) (settingslua.AURPreInstallEvent, error) {
	dir, pkgbuildPath, srcinfoPath := aurPreInstallPaths(path)

	pkgbuildBytes, err := os.ReadFile(pkgbuildPath)
	if err != nil {
		return settingslua.AURPreInstallEvent{},
			fmt.Errorf("%s %s: read PKGBUILD: %w", eventName, base, err)
	}

	srcinfo, err := gosrc.ParseFile(srcinfoPath)
	if err != nil {
		return settingslua.AURPreInstallEvent{},
			fmt.Errorf("%s %s: parse .SRCINFO: %w", eventName, base, err)
	}

	if len(packages) == 0 {
		packages = packagesFromSRCINFO(srcinfo)
	}
	slices.SortFunc(packages, func(a, b settingslua.AURPreInstallPackage) int { return cmp.Compare(a.Name, b.Name) })

	return settingslua.AURPreInstallEvent{
		Base:         base,
		Dir:          dir,
		PKGBUILDPath: pkgbuildPath,
		SRCINFOPath:  srcinfoPath,
		PKGBUILD:     string(pkgbuildBytes),
		Version:      srcinfo.Version(),
		LastModified: aurPreInstallLastModified(base, targets),
		Installed:    aurPreInstallInstalled(packages, srcinfo, installed),
		Packages:     packages,
		SRCINFO:      srcinfoEventData(srcinfo),

View on GitHub (pinned to 328f4b4939)