{"record":{"id":"49210c445959499b","repo":"wtfutil/wtf","slug":"github-client-v4-failed-to-load","errorCode":null,"errorMessage":"github client v4 failed to load","messagePattern":"github client v4 failed to load","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"support/github.go","lineNumber":222,"sourceCode":"\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":204,"sourceCodeEnd":227,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/support/github.go#L204-L227","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nexport GITHUB_TOKEN=\"\"  # empty -> clientV4 == nil\n\n// after\nexport GITHUB_TOKEN=\"ghp_xxxxxxxxxxxxxxxxxxxxxxxx\"\nwtfutil","handlingStrategy":"validation","validationCode":"if os.Getenv(\"GITHUB_TOKEN\") == \"\" {\n    return errors.New(\"GraphQL (v4) client requires a non-empty GitHub token\")\n}","typeGuard":null,"tryCatchPattern":"if err := ghUser.Load(); err != nil {\n    if err.Error() == \"github client v4 failed to load\" {\n        // supply token and re-run Load\n    }\n}","preventionTips":["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."],"tags":["github","graphql","initialization","authentication"],"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"}