Jguer/yay · error

unable to generate .SRCINFO

Error message

unable to generate .SRCINFO: %w - %s

What it means

Returned by srcinfoExists when a PKGBUILD exists but no .SRCINFO does, and running 'makepkg --printsrcinfo' via the command builder fails. The wrapped error is the makepkg execution failure and stderr is appended, so the message shows why source-info generation failed — commonly a broken PKGBUILD, missing build tooling, or a makepkg syntax error.

Solutions

  1. Run 'makepkg --printsrcinfo' manually in the target directory to see the failure
  2. Fix syntax or sourcing errors in the PKGBUILD
  3. Ensure makepkg and its dependencies (bash, pacman) are installed
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at local_install.go:42 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at local_install.go:42

var ErrNoBuildFiles = errors.New(gotext.Get("cannot find PKGBUILD and .SRCINFO in directory"))

func srcinfoExists(ctx context.Context,
	cmdBuilder exe.ICmdBuilder, targetDir string,
) error {
	srcInfoDir := filepath.Join(targetDir, ".SRCINFO")
	pkgbuildDir := filepath.Join(targetDir, "PKGBUILD")
	if _, err := os.Stat(srcInfoDir); err == nil {
		if _, err := os.Stat(pkgbuildDir); err == nil {
			return nil
		}
	}

	if _, err := os.Stat(pkgbuildDir); err == nil {
		// run makepkg to generate .SRCINFO
		srcinfo, stderr, err := cmdBuilder.Capture(cmdBuilder.BuildMakepkgCmd(ctx, targetDir, "--printsrcinfo"))
		if err != nil {
			return fmt.Errorf("unable to generate .SRCINFO: %w - %s", err, stderr)
		}

		if srcinfo == "" {
			return fmt.Errorf("generated .SRCINFO is empty, check your PKGBUILD for errors")
		}

		if err := os.WriteFile(srcInfoDir, []byte(srcinfo), 0o600); err != nil {
			return fmt.Errorf("unable to write .SRCINFO: %w", err)
		}

		return nil
	}

	return fmt.Errorf("%w: %s", ErrNoBuildFiles, targetDir)
}

func installLocalPKGBUILD(
	ctx context.Context,

View on GitHub (pinned to 328f4b4939)