{"record":{"id":"f190f36c65ed45d1","repo":"Jguer/yay","slug":"s-s-read-pkgbuild-w","errorCode":null,"errorMessage":"%s %s: read PKGBUILD: %w","messagePattern":"(.+?) (.+?): read PKGBUILD: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/sync/workdir/aur_preinstall.go","lineNumber":101,"sourceCode":"func sortedAURBases(pkgbuildDirsByBase map[string]string) []string {\n\treturn slices.Sorted(maps.Keys(pkgbuildDirsByBase))\n}\n\nfunc aurPreInstallEvent(base, path string, packages []settingslua.AURPreInstallPackage,\n\tinstalled mapset.Set[string], targets []map[string]*dep.InstallInfo,\n) (settingslua.AURPreInstallEvent, error) {\n\treturn aurPackageEvent(settingslua.EventAURPreInstall, base, path, packages, installed, targets)\n}\n\nfunc aurPackageEvent(eventName, base, path string, packages []settingslua.AURPreInstallPackage,\n\tinstalled mapset.Set[string], targets []map[string]*dep.InstallInfo,\n) (settingslua.AURPreInstallEvent, error) {\n\tdir, pkgbuildPath, srcinfoPath := aurPreInstallPaths(path)\n\n\tpkgbuildBytes, err := os.ReadFile(pkgbuildPath)\n\tif err != nil {\n\t\treturn settingslua.AURPreInstallEvent{},\n\t\t\tfmt.Errorf(\"%s %s: read PKGBUILD: %w\", eventName, base, err)\n\t}\n\n\tsrcinfo, err := gosrc.ParseFile(srcinfoPath)\n\tif err != nil {\n\t\treturn settingslua.AURPreInstallEvent{},\n\t\t\tfmt.Errorf(\"%s %s: parse .SRCINFO: %w\", eventName, base, err)\n\t}\n\n\tif len(packages) == 0 {\n\t\tpackages = packagesFromSRCINFO(srcinfo)\n\t}\n\tslices.SortFunc(packages, func(a, b settingslua.AURPreInstallPackage) int { return cmp.Compare(a.Name, b.Name) })\n\n\treturn settingslua.AURPreInstallEvent{\n\t\tBase:         base,\n\t\tDir:          dir,\n\t\tPKGBUILDPath: pkgbuildPath,\n\t\tSRCINFOPath:  srcinfoPath,","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/Jguer/yay/blob/328f4b4939fb35f38c2f7c7ce3b8638a839bafa5/pkg/sync/workdir/aur_preinstall.go#L83-L119","documentation":"Wraps `os.ReadFile` failures when reading a PKGBUILD from an AUR package's clone/build directory while emitting an AUR pre-install (or post-download) event. Without the PKGBUILD the Lua event cannot be populated, so the operation aborts with the event name and pkgbase in the message.","triggerScenarios":"`aurPackageEvent` calls `os.ReadFile(pkgbuildPath)` on `<dir>/PKGBUILD` and the file is missing (incomplete clone), unreadable (permissions), or the path points to a stale/removed build directory.","commonSituations":"Interrupted AUR clone leaving a directory without PKGBUILD, another user owning ~/.cache/yay contents (root vs user runs), disk cleanup removing build dirs mid-operation, SELinux/AppArmor denying read.","solutions":["Re-clone the package build dir: remove `<cachedir>/<base>` and rerun the install so git re-downloads the PKGBUILD.","Check permissions on the build/cache directory and fix ownership (e.g. `chown -R $USER ~/.cache/yay`).","Verify the directory actually contains a PKGBUILD; if not, the clone is corrupt and must be refreshed.","Check disk space and filesystem errors in the wrapped cause."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if _, err := os.Stat(filepath.Join(dir, \"PKGBUILD\")); err != nil {\n    // re-clone the build dir before proceeding\n}","typeGuard":null,"tryCatchPattern":"var event settingslua.AURPreInstallEvent\nevent, err := aurPreInstallEvent(base, dir, pkgs, installed, targets)\nif err != nil {\n    return fmt.Errorf(\"aur event for %s: %w\", base, err)\n}","preventionTips":["Don't share cache/build dirs between users; keep ownership consistent","Avoid deleting or cleaning build dirs while operations are running","Re-clone any build dir missing its PKGBUILD before retrying"],"tags":["aur","pkgbuild","file-read","filesystem"],"backgroundTag":"file-read-failed","analyzedSha":"328f4b4939fb35f38c2f7c7ce3b8638a839bafa5","analyzedAt":"2026-09-07T16:45:12.608Z","contentChangedAt":"2026-09-07T16:45:12.608Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}