Jguer/yay · error

could not find all required packages

Error message

could not find all required packages: %s %s

What it means

Yay wraps ErrPackagesNotFound when dependency graph resolution finds install targets whose Source is dep.Missing, i.e. a package name (and version) that could not be resolved from repos or the AUR. The message is formed as 'could not find all required packages: <name> <version>' per missing target, joined via errors.Join before install proceeds. It is a deliberate abort so partial/incorrect installs never happen.

Solutions

  1. Run with updated sync db first: yay -Syu (or pacman -Sy) so repo data is fresh
  2. Verify each name/version: yay -Ss <name>; fix typos or drop stale version constraints
  3. Search the AUR web UI — if the pkgbase was removed, find a fork or replacement
  4. If it's a dep of another AUR pkg, check/update that pkgbuild's depends or build the dep manually

Example fix

// before
err := fmt.Errorf("%w: %s %s", ErrPackagesNotFound, name, ii.Version) // surfaced as 'could not find all required packages: foo 2.0'
// after
// resolve cause first: ensure db is synced and the name/version actually exists, then retry the install
if err := exec.Command("pacman", "-Sy").Run(); err != nil { ... }
_, ok := aurClient.Search(ctx, name); if !ok { log.Fatalf("package %s not found in AUR/repos", name) }
Defensive patterns

Strategy: validation

Validate before calling

// resolve each target before install
for _, name := range pkgNames {
    if _, _, e := aurClient.Info(ctx, []string{name}); e != nil || results.Empty() {
        if !repoExists(name) { return fmt.Errorf("package %q not found in repos or AUR", name) }
    }
}
// and keep the local db fresh: exec.Command("pacman", "-Sy")

Type guard

func isPackagesNotFound(err error) bool { return errors.Is(err, ErrPackagesNotFound) }

Try / catch

if err := yayInstall(pkgs); err != nil {
    if isPackagesNotFound(err) {
        for _, sc := range strings.Split(err.Error(), "\n") { log.Printf("missing: %s", sc) }
        return // don't retry blindly; fix names/versions first
    }
    return err
}

Prevention

When it happens

Trigger: sync.NewOperationService-driven install flow calls graph.TopoSortedLayers; any dep.InstallInfo with Source == dep.Missing (package name typo, package removed from AUR, repo not synced, wrong repo priority, or an unsatisfiable version constraint) appends ErrPackagesNotFound and the joined error aborts the operation.

Common situations: Typo'd package names on the command line or as deps; a deprecated/deleted AUR package; pacman db not synced (no -y) so repo packages look missing; version requirements like pkg>=99 that no provider satisfies.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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

Appendix: source

Thrown at local_install.go:98

			return fmt.Errorf("%s: %w", gotext.Get("failed to parse .SRCINFO"), err)
		}

		srcInfos[targetDir] = pkgbuild
	}

	grapher := dep.NewGrapher(dbExecutor, aurCache, false, settings.NoConfirm,
		cmdArgs.ExistsDouble("d", "nodeps"), noCheck, cmdArgs.ExistsArg("needed"),
		run.Logger.Child("grapher"))
	graph, err := grapher.GraphFromSrcInfos(ctx, nil, srcInfos)
	if err != nil {
		return err
	}

	opService := sync.NewOperationService(ctx, dbExecutor, run)
	var errs []error
	targets := graph.TopoSortedLayers(func(name string, ii *dep.InstallInfo) error {
		if ii.Source == dep.Missing {
			errs = append(errs, fmt.Errorf("%w: %s %s", ErrPackagesNotFound, name, ii.Version))
		}
		return nil
	})

	if err := errors.Join(errs...); err != nil {
		return err
	}
	return opService.Run(ctx, run, cmdArgs, targets, []string{})
}

View on GitHub (pinned to 328f4b4939)