Jguer/yay · error
reading architectures for .SRCINFO
Error message
reading architectures for .SRCINFO: %w
What it means
PackagesFromSrcinfo converts a parsed .SRCINFO into aur.Pkg entries, and first asks the local database executor for the machine's ALPM architectures via dbExecutor.AlpmArchitectures(). If that query fails, the error is wrapped as 'reading architectures for .SRCINFO: <err>' and returned. This arch list is needed to select the right arch-specific sections of the .SRCINFO (an empty string is appended because srcinfo treats missing arch as no value).
Solutions
- Check the pacman db: sudo pacman -Dk (validate) and inspect /var/lib/pacman/local for corruption
- Ensure no concurrent pacman/yay holds the db lock; remove stale /var/lib/pacman/db.lck only if no process runs
- Re-sync db and verify yay's pacman version matches libalpm: pacman -Sy && yay -V
- Recreate the local db from cache if corrupt: sudo pacman -Qqen ... / reinstall flow, or restore from /var/lib/pacman backup
Example fix
// before
alpmArch, err := dbExecutor.AlpmArchitectures()
if err != nil { return nil, fmt.Errorf("reading architectures for .SRCINFO: %w", err) }
// after
// diagnose underlying db failure before retrying
alpmArch, err := dbExecutor.AlpmArchitectures()
if err != nil {
log.Printf("alpm db unreadable (%v); running pacman-db validation", err)
if out, e := exec.Command("sudo", "pacman", "-Dk").CombinedOutput(); e != nil { log.Fatalf("pacman db broken: %s", out) }
alpmArch, err = dbExecutor.AlpmArchitectures()
} Defensive patterns
Strategy: try-catch
Validate before calling
// verify pacman local db is readable before parsing srcinfo
if _, err := os.Stat("/var/lib/pacman/local"); err != nil { return fmt.Errorf("pacman local db missing: %w", err) }
if err := exec.Command("pacman", "-Dk").Run(); err != nil { return fmt.Errorf("pacman db invalid: %w", err) } Try / catch
pkgs, err := dep.PackagesFromSrcinfo(dbExecutor, srcInfo)
if err != nil {
if strings.Contains(err.Error(), "reading architectures for .SRCINFO") {
return fmt.Errorf("alpm/pacman database problem; run `pacman -Dk` and check /var/lib/pacman: %w", err)
}
return err
} Prevention
- Never delete or hand-edit /var/lib/pacman/local while yay runs
- Avoid running pacman/yay concurrently; check db.lck
- Keep pacman/yay versions in sync (matching libalpm)
- Run pacman -Dk periodically to catch db corruption early
When it happens
Trigger: Any call path into PackagesFromSrcinfo (GraphFromSrcinfos, Test* helpers, yay's AUR install when parsing .SRCINFO from a cloned PKGBUILD) where dbExecutor.AlpmArchitectures() fails — typically the pacman/alpm local database can't be opened or read.
Common situations: Corrupt or locked pacman local database (/var/lib/pacman/local), mismatched libalpm version, running in a container with a broken pacman db, or permission issues reading the db.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- only one operation may be used at a time
- failed to parse
- could not find all required packages
- %w %s
- : parse .SRCINFO
AI-assisted analysis of Jguer/yay@328f4b4939 (2026-09-07).
Data as JSON: /api/errors/93416513568fcb95.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/dep/dep_graph.go:846
if num < 1 || num >= size {
g.logger.Errorln(gotext.Get("invalid value: %d is not between %d and %d",
num, 1, size-1))
continue
}
return &options[num-1]
}
}
// PackagesFromSrcinfo converts repository metadata into package metadata used
// by dependency resolution and local package information displays.
func PackagesFromSrcinfo(dbExecutor db.Executor, srcInfo *gosrc.Srcinfo) ([]*aur.Pkg, error) {
pkgs := make([]*aur.Pkg, 0, 1)
alpmArch, err := dbExecutor.AlpmArchitectures()
if err != nil {
return nil, fmt.Errorf("reading architectures for .SRCINFO: %w", err)
}
alpmArch = append(alpmArch, "") // srcinfo assumes no value as ""
getDesc := func(pkg *gosrc.Package) string { return cmp.Or(pkg.Pkgdesc, srcInfo.Pkgdesc) }
// srcInfo.Packages holds only the per-package overrides; anything declared
// once at the pkgbase level lives on srcInfo itself. Fall back to it so a
// plain (non-split) PKGBUILD does not report these as empty.
fallback := func(pkg, base []string) []string {
if len(pkg) > 0 {
return pkg
}
return base
}
for i := range srcInfo.Packages {View on GitHub (pinned to 328f4b4939)