Jguer/yay · error

failed to parse

Error message

failed to parse %s: %s

What it means

ParseSrcinfoFilesByBase parses .SRCINFO files for each pkgbase and, when parsing fails and the error is fatal (errIsFatal), aborts the whole batch with 'failed to parse <base>: <err>'. Non-fatal parse failures are only warned about and skipped. It means a .SRCINFO for the named pkgbase is malformed and the caller asked for strict handling.

Solutions

  1. Inspect the pkgbase directory named in the message and regenerate its .SRCINFO (e.g. 'makepkg --printsrcinfo > .SRCINFO').
  2. Remove the corrupt pkgbuild directory and let yay re-clone it (delete it under the yay build/cache dir, e.g. ~/.cache/yay/<pkgbase>).
  3. Update the package: the maintainer may have pushed a fixed PKGBUILD; re-run the operation to re-sync.
  4. If it only affects devel packages, rebuild the devel DB (remove the devel DB file so createDevelDB regenerates it).

Example fix

// before
$ yay -Sua
failed to parse linux-mainline: ... 
// after
$ rm -rf ~/.cache/yay/linux-mainline && yay -Sua
Defensive patterns

Strategy: try-catch

Validate before calling

// sanity-check .SRCINFO before batch parse
f, err := os.Open(filepath.Join(dir, ".SRCINFO"))
if err != nil || f == nil {
    return fmt.Errorf("missing or unreadable .SRCINFO in %s", dir)
}

Try / catch

svc, err := srcinfo.NewService(db, logger, cmdBuilder, cache)
if err != nil {
    if strings.Contains(err.Error(), "failed to parse") {
        // drop the offending pkgbase dir and retry with a fresh clone
        os.RemoveAll(offendingDir)
    }
    return err
}

Prevention

When it happens

Trigger: NewService or createDevelDB calling ParseSrcinfoFilesByBase over cloned PKGBUILD repos where a generated .SRCINFO violates srcinfo format (bad field, unparsable pkgbuild), with fatal error handling enabled.

Common situations: AUR pkgbuild repos with corrupted or hand-edited .SRCINFO; interrupted git merges leaving stale srcinfo files in the devel DB; version changes in the srcinfo parser being stricter than the generator that wrote the file.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at pkg/sync/srcinfo/service.go:123

	return nil
}

func ParseSrcinfoFilesByBase(logger *text.Logger, pkgBuildDirs map[string]string, errIsFatal bool) (map[string]*gosrc.Srcinfo, error) {
	srcinfos := make(map[string]*gosrc.Srcinfo)

	k := 0
	for base, dir := range pkgBuildDirs {
		logger.OperationInfoln(gotext.Get("(%d/%d) Parsing SRCINFO: %s", k+1, len(pkgBuildDirs), text.Cyan(base)))

		pkgbuild, err := gosrc.ParseFile(filepath.Join(dir, ".SRCINFO"))
		if err != nil {
			if !errIsFatal {
				logger.Warnln(gotext.Get("failed to parse %s -- skipping: %s", base, err))
				continue
			}

			return nil, errors.New(gotext.Get("failed to parse %s: %s", base, err))
		}

		srcinfos[base] = pkgbuild
		k++
	}

	return srcinfos, nil
}

View on GitHub (pinned to 328f4b4939)