wtfutil/wtf · error
github client v3 failed to load
Error message
github client v3 failed to load
What it means
GitHubUser.verifyGitHubClients (invoked during support/github.go Load) guards the two GitHub API clients the user object depends on. If the go-github v3 REST client (clientV3) is nil — meaning its initialization failed earlier, typically due to missing/invalid OAuth token or a constructor error — Load aborts with this error.
Source
Thrown at support/github.go:218
if err != nil {
return false, err
}
isSponsor := false
for _, spon := range sponsorQuery.User.SponsorshipsAsSponsor.Nodes {
if spon.Sponsorable.SponsorsListing.Slug == "sponsors-felicianotech" {
isSponsor = true
break
}
}
return isSponsor, nil
}
func (ghUser *GitHubUser) verifyGitHubClients() error {
if ghUser.clientV3 == nil {
return errors.New("github client v3 failed to load")
}
if ghUser.clientV4 == nil {
return errors.New("github client v4 failed to load")
}
return nil
}
View on GitHub (pinned to bb838c1ccb)
Solutions
- Set a valid GitHub personal access token in the github module settings (apiKey) or the expected environment variable.
- Regenerate the token if it was revoked or expired, granting the required scopes.
- Restart WTFUtil after fixing configuration so Load() reinitializes the clients.
- Check WTFUtil logs/startup output for the underlying client-creation failure.
Example fix
// before (settings.yml) github: # apiKey missing -> clientV3 == nil // after github: apiKey: "ghp_xxxxxxxxxxxxxxxxxxxxxxxx"
Defensive patterns
Strategy: validation
Validate before calling
token := os.Getenv("WTF_GITHUB_TOKEN")
if token == "" {
return errors.New("GitHub API token required so v3 client can initialize")
} Try / catch
if err := ghUser.Load(); err != nil {
if err.Error() == "github client v3 failed to load" {
// fix token/config, then re-run Load
}
} Prevention
- Always set the GitHub token before enabling github-based modules.
- Rotate tokens before expiry and update the config.
- Check startup logs for silent client-creation failures.
When it happens
Trigger: support/github.go Load() -> GitHubUser.verifyGitHubClients(): ghUser.clientV3 is nil because the v3 client construction (github.NewClient with an OAuth2 token source) failed or was skipped — usually a missing/blank GitHub API token in the WTFUtil config.
Common situations: apiKey not set or empty in the github module settings; environment token (e.g. WTF_GITHUB_TOKEN) unset; malformed token so oauth2 client setup failed; earlier error swallowed during initialization leaving the client nil.
Related errors
- github client v4 failed to load
- client was not initialized
- command shell not defined in $SHELL environment variable
- authentication failed! Please log in to Spotify by visiting
- errors.New(response.ErrorMessage)
AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03).
Data as JSON: /api/errors/e6e904c3a1e3e869.
Report an issue: GitHub.