Jguer/yay · error

only one target is allowed

Error message

only one target is allowed

What it means

Returned by graphPackage in the standalone graph debug tool when the number of positional targets is not exactly one. The tool renders the dependency graph of a single AUR package, so zero or multiple targets are rejected before GraphFromAUR is called. Pure arity validation on cmdArgs.Targets.

Solutions

  1. Invoke the tool with exactly one package target, e.g. 'graph <package-name>'
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/cmd/graph/main.go:70 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/4374f62780d75782. Report an issue: GitHub.

Appendix: source

Thrown at pkg/cmd/graph/main.go:70

	return graphPackage(context.Background(), grapher, cmdArgs.Targets)
}

func main() {
	fallbackLog := text.NewLogger(os.Stdout, os.Stderr, os.Stdin, false, "fallback")
	if err := handleCmd(fallbackLog); err != nil {
		fallbackLog.Errorln(err)
		os.Exit(1)
	}
}

func graphPackage(
	ctx context.Context,
	grapher *dep.Grapher,
	targets []string,
) error {
	if len(targets) != 1 {
		return errors.New(gotext.Get("only one target is allowed"))
	}

	graph, err := grapher.GraphFromAUR(ctx, nil, []string{targets[0]})
	if err != nil {
		return err
	}

	fmt.Fprintln(os.Stdout, graph.String())
	fmt.Fprintln(os.Stdout, "\nlayers map\n", graph.TopoSortedLayers(nil))

	return nil
}

View on GitHub (pinned to 328f4b4939)