{"record":{"id":"e6e904c3a1e3e869","repo":"wtfutil/wtf","slug":"github-client-v3-failed-to-load","errorCode":null,"errorMessage":"github client v3 failed to load","messagePattern":"github client v3 failed to load","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"support/github.go","lineNumber":218,"sourceCode":"\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tisSponsor := false\n\n\tfor _, spon := range sponsorQuery.User.SponsorshipsAsSponsor.Nodes {\n\t\tif spon.Sponsorable.SponsorsListing.Slug == \"sponsors-felicianotech\" {\n\t\t\tisSponsor = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn isSponsor, nil\n}\n\nfunc (ghUser *GitHubUser) verifyGitHubClients() error {\n\tif ghUser.clientV3 == nil {\n\t\treturn errors.New(\"github client v3 failed to load\")\n\t}\n\n\tif ghUser.clientV4 == nil {\n\t\treturn errors.New(\"github client v4 failed to load\")\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":200,"sourceCodeEnd":227,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/support/github.go#L200-L227","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (settings.yml)\ngithub:\n  # apiKey missing -> clientV3 == nil\n\n// after\ngithub:\n  apiKey: \"ghp_xxxxxxxxxxxxxxxxxxxxxxxx\"","handlingStrategy":"validation","validationCode":"token := os.Getenv(\"WTF_GITHUB_TOKEN\")\nif token == \"\" {\n    return errors.New(\"GitHub API token required so v3 client can initialize\")\n}","typeGuard":null,"tryCatchPattern":"if err := ghUser.Load(); err != nil {\n    if err.Error() == \"github client v3 failed to load\" {\n        // fix token/config, then re-run Load\n    }\n}","preventionTips":["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."],"tags":["github","initialization","authentication","configuration"],"backgroundTag":"client-not-initialized","analyzedSha":"bb838c1ccb0f0f3223690df44afdec663d622881","analyzedAt":"2026-09-03T17:02:45.030Z","contentChangedAt":"2026-09-03T17:02:45.030Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}