wtfutil/wtf · error
github client v4 failed to load
Error message
github client v4 failed to load
What it means
Companion check to the v3 guard: verifyGitHubClients also verifies clientV4, the GitHub GraphQL (v4) client. A nil clientV4 means the GraphQL client failed to initialize during Load, so GitHubUser cannot run GraphQL queries and Load returns this error.
Source
Thrown at support/github.go:222
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
- Provide a valid GitHub personal access token (GraphQL always requires authentication) in the module settings.
- Confirm the token has not expired/been revoked and has appropriate scopes (repo/read:user).
- If using GitHub Enterprise, verify the GraphQL endpoint/base URL configuration.
- Restart WTFUtil so Load() re-creates both clients after the config fix.
Example fix
// before export GITHUB_TOKEN="" # empty -> clientV4 == nil // after export GITHUB_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxxxxxx" wtfutil
Defensive patterns
Strategy: validation
Validate before calling
if os.Getenv("GITHUB_TOKEN") == "" {
return errors.New("GraphQL (v4) client requires a non-empty GitHub token")
} Try / catch
if err := ghUser.Load(); err != nil {
if err.Error() == "github client v4 failed to load" {
// supply token and re-run Load
}
} Prevention
- Remember GitHub GraphQL always requires authentication — never configure an empty token.
- Grant repo/read:user scopes to the PAT.
- For GitHub Enterprise, verify the GraphQL endpoint URL configuration.
When it happens
Trigger: support/github.go Load() -> verifyGitHubClients(): ghUser.clientV4 is nil — GraphQL client construction failed, almost always because no GitHub API token was available (v4 requires auth) or the token source was misconfigured.
Common situations: Missing/empty GitHub token in module settings; token lacking scopes needed for GraphQL; misconfigured enterprise GitHub base URL; initialization error earlier in Load silently leaving the v4 client nil.
Related errors
- github client v3 failed to load
- authentication failed! Please log in to Spotify by visiting
- client was not initialized
- errors.New(response.ErrorMessage)
- failed to create Azure Logs client for subscription %s: %w
AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03).
Data as JSON: /api/errors/49210c445959499b.
Report an issue: GitHub.