{"record":{"id":"d9c301c9131c30d0","repo":"Jguer/yay","slug":"s-please-set-aur-username-and-aur-password-envir","errorCode":null,"errorMessage":"%s: please set AUR_USERNAME and AUR_PASSWORD environment variables for voting","messagePattern":"(.+?): please set AUR_USERNAME and AUR_PASSWORD environment variables for voting","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vote.go","lineNumber":50,"sourceCode":"\t\treturn err\n\t}\n\n\tif len(infos) == 0 {\n\t\tlogger.Println(gotext.Get(\" there is nothing to do\"))\n\t\treturn nil\n\t}\n\n\tfor i := range infos {\n\t\tvar err error\n\t\tif upvote {\n\t\t\terr = voteClient.Vote(ctx, infos[i].PackageBase)\n\t\t} else {\n\t\t\terr = voteClient.Unvote(ctx, infos[i].PackageBase)\n\t\t}\n\n\t\tif err != nil {\n\t\t\tif errors.Is(err, vote.ErrNoCredentials) {\n\t\t\t\treturn errors.New(\n\t\t\t\t\tgotext.Get(\"%s: please set AUR_USERNAME and AUR_PASSWORD environment variables for voting\",\n\t\t\t\t\t\terr.Error()))\n\t\t\t}\n\n\t\t\treturn &ErrAURVote{inner: err, pkgName: infos[i].Name}\n\t\t}\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":32,"sourceCodeEnd":61,"githubUrl":"https://github.com/Jguer/yay/blob/328f4b4939fb35f38c2f7c7ce3b8638a839bafa5/vote.go#L32-L61","documentation":"handlePackageVote detects the sentinel vote.ErrNoCredentials from the AUR vote client and replaces it with this error telling the user to export AUR_USERNAME and AUR_PASSWORD. The AUR voting RPC requires authenticated credentials, and without them voting/unvoting cannot proceed. The original error text is embedded at the start of the message.","triggerScenarios":"Running `yay -S <pkg>` with vote enabled, or explicit vote/unvote operations, when voteClient.Vote/Unvote returns vote.ErrNoCredentials because AUR_USERNAME and AUR_PASSWORD are unset in the environment.","commonSituations":"Users running yay from cron/systemd where the interactive shell environment (often holding the vars) is absent; fresh installs where voting env vars were never exported; running yay via sudo which strips environment variables.","solutions":["Export AUR_USERNAME and AUR_PASSWORD before running yay: `export AUR_USERNAME=... AUR_PASSWORD=...`","Preserve the vars through sudo with `sudo -E yay ...` or sudo env_keep configuration","Verify with `echo $AUR_USERNAME $AUR_PASSWORD` in the same shell that runs yay","If voting is unwanted, disable the vote feature in yay config so the client is never invoked"],"exampleFix":"// before\n$ yay -S linux\nlinux: please set AUR_USERNAME and AUR_PASSWORD environment variables for voting\n// after\n$ export AUR_USERNAME=myuser AUR_PASSWORD='mypass'\n$ yay -S linux","handlingStrategy":"validation","validationCode":"if os.Getenv(\"AUR_USERNAME\") == \"\" || os.Getenv(\"AUR_PASSWORD\") == \"\" {\n\treturn errors.New(\"AUR_USERNAME and AUR_PASSWORD must be set before voting\")\n}","typeGuard":"func hasVoteCredentials() bool {\n\tu, p := os.LookupEnv(\"AUR_USERNAME\"), os.LookupEnv(\"AUR_PASSWORD\")\n\treturn u != \"\" && p != \"\"\n}","tryCatchPattern":"err := yayVote(pkg)\nif err != nil {\n\tif strings.Contains(err.Error(), \"AUR_USERNAME and AUR_PASSWORD\") {\n\t\treturn fmt.Errorf(\"voting skipped for %s: set AUR_USERNAME/AUR_PASSWORD\", pkg)\n\t}\n\treturn err\n}","preventionTips":["Export AUR_USERNAME/AUR_PASSWORD in your shell profile if you use the vote feature","Use `sudo -E` or sudo env_keep when running yay with sudo","Check that cron/systemd units source the profile that defines the credentials","Disable voting in yay config if you never vote"],"tags":["aur","voting","environment-variables","credentials"],"backgroundTag":"missing-credentials","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"}