Jguer/yay · error
: please set AUR_USERNAME and AUR_PASSWORD environment…
Error message
%s: please set AUR_USERNAME and AUR_PASSWORD environment variables for voting
What it means
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.
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
Example fix
// before $ yay -S linux linux: please set AUR_USERNAME and AUR_PASSWORD environment variables for voting // after $ export AUR_USERNAME=myuser AUR_PASSWORD='mypass' $ yay -S linux
Defensive patterns
Strategy: validation
Validate before calling
if os.Getenv("AUR_USERNAME") == "" || os.Getenv("AUR_PASSWORD") == "" {
return errors.New("AUR_USERNAME and AUR_PASSWORD must be set before voting")
} Type guard
func hasVoteCredentials() bool {
u, p := os.LookupEnv("AUR_USERNAME"), os.LookupEnv("AUR_PASSWORD")
return u != "" && p != ""
} Try / catch
err := yayVote(pkg)
if err != nil {
if strings.Contains(err.Error(), "AUR_USERNAME and AUR_PASSWORD") {
return fmt.Errorf("voting skipped for %s: set AUR_USERNAME/AUR_PASSWORD", pkg)
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed to parse
- error resetting
- could not find all required packages
- failed to retrieve aur Cache
- invalid status code
AI-assisted analysis of Jguer/yay@328f4b4939 (2026-09-07).
Data as JSON: /api/errors/d9c301c9131c30d0.
Report an issue: GitHub.
Appendix: source
Thrown at vote.go:50
return err
}
if len(infos) == 0 {
logger.Println(gotext.Get(" there is nothing to do"))
return nil
}
for i := range infos {
var err error
if upvote {
err = voteClient.Vote(ctx, infos[i].PackageBase)
} else {
err = voteClient.Unvote(ctx, infos[i].PackageBase)
}
if err != nil {
if errors.Is(err, vote.ErrNoCredentials) {
return errors.New(
gotext.Get("%s: please set AUR_USERNAME and AUR_PASSWORD environment variables for voting",
err.Error()))
}
return &ErrAURVote{inner: err, pkgName: infos[i].Name}
}
}
return nil
}
View on GitHub (pinned to 328f4b4939)