Jguer/yay · error

no target directories specified

Error message

no target directories specified

What it means

Returned by installLocalPKGBUILD when the -B/--build operation was invoked with an empty target list (cmdArgs.Targets has no entries). Local build mode requires at least one directory path to a PKGBUILD; without targets there is nothing to install, so the function aborts before touching the filesystem.

Solutions

  1. Pass at least one directory containing a PKGBUILD, e.g. 'yay -B ./my-package-dir'
  2. Use 'yay -B .' to build from the current directory
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at local_install.go:69 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/c7d07b587dac7f6b. Report an issue: GitHub.

Appendix: source

Thrown at local_install.go:69

		}

		return nil
	}

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

func installLocalPKGBUILD(
	ctx context.Context,
	run *runtime.Runtime,
	cmdArgs *parser.Arguments,
	dbExecutor db.Executor,
) error {
	aurCache := run.AURClient
	noCheck := strings.Contains(run.Cfg.MFlags, "--nocheck")

	if len(cmdArgs.Targets) < 1 {
		return errors.New(gotext.Get("no target directories specified"))
	}

	srcInfos := map[string]*gosrc.Srcinfo{}
	for _, targetDir := range cmdArgs.Targets {
		if err := srcinfoExists(ctx, run.CmdBuilder, targetDir); err != nil {
			return err
		}

		pkgbuild, err := gosrc.ParseFile(filepath.Join(targetDir, ".SRCINFO"))
		if err != nil {
			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"),

View on GitHub (pinned to 328f4b4939)