{"record":{"id":"4374f62780d75782","repo":"Jguer/yay","slug":"only-one-target-is-allowed","errorCode":null,"errorMessage":"only one target is allowed","messagePattern":"only one target is allowed","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/graph/main.go","lineNumber":70,"sourceCode":"\n\treturn graphPackage(context.Background(), grapher, cmdArgs.Targets)\n}\n\nfunc main() {\n\tfallbackLog := text.NewLogger(os.Stdout, os.Stderr, os.Stdin, false, \"fallback\")\n\tif err := handleCmd(fallbackLog); err != nil {\n\t\tfallbackLog.Errorln(err)\n\t\tos.Exit(1)\n\t}\n}\n\nfunc graphPackage(\n\tctx context.Context,\n\tgrapher *dep.Grapher,\n\ttargets []string,\n) error {\n\tif len(targets) != 1 {\n\t\treturn errors.New(gotext.Get(\"only one target is allowed\"))\n\t}\n\n\tgraph, err := grapher.GraphFromAUR(ctx, nil, []string{targets[0]})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Fprintln(os.Stdout, graph.String())\n\tfmt.Fprintln(os.Stdout, \"\\nlayers map\\n\", graph.TopoSortedLayers(nil))\n\n\treturn nil\n}\n","sourceCodeStart":52,"sourceCodeEnd":83,"githubUrl":"https://github.com/Jguer/yay/blob/328f4b4939fb35f38c2f7c7ce3b8638a839bafa5/pkg/cmd/graph/main.go#L52-L83","documentation":"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.","triggerScenarios":"Thrown at pkg/cmd/graph/main.go:70 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Invoke the tool with exactly one package target, e.g. 'graph <package-name>'"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}