{"record":{"id":"f32d79638509e4b4","repo":"github/github-mcp-server","slug":"failed-to-get-github-client-w-f32d79","errorCode":null,"errorMessage":"failed to get GitHub client: %w","messagePattern":"failed to get GitHub client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/security_advisories.go","lineNumber":92,"sourceCode":"\t\t\t\t\t\tType:        \"string\",\n\t\t\t\t\t\tDescription: \"Filter by publish date or date range (ISO 8601 date or range).\",\n\t\t\t\t\t},\n\t\t\t\t\t\"updated\": {\n\t\t\t\t\t\tType:        \"string\",\n\t\t\t\t\t\tDescription: \"Filter by update date or date range (ISO 8601 date or range).\",\n\t\t\t\t\t},\n\t\t\t\t\t\"modified\": {\n\t\t\t\t\t\tType:        \"string\",\n\t\t\t\t\t\tDescription: \"Filter by publish or update date or date range (ISO 8601 date or range).\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t[]scopes.Scope{scopes.SecurityEvents},\n\t\tfunc(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {\n\t\t\tclient, err := deps.GetClient(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"failed to get GitHub client: %w\", err)\n\t\t\t}\n\n\t\t\tghsaID, err := OptionalParam[string](args, \"ghsaId\")\n\t\t\tif err != nil {\n\t\t\t\treturn utils.NewToolResultError(fmt.Sprintf(\"invalid ghsaId: %v\", err)), nil, nil\n\t\t\t}\n\n\t\t\ttyp, err := OptionalParam[string](args, \"type\")\n\t\t\tif err != nil {\n\t\t\t\treturn utils.NewToolResultError(fmt.Sprintf(\"invalid type: %v\", err)), nil, nil\n\t\t\t}\n\n\t\t\tcveID, err := OptionalParam[string](args, \"cveId\")\n\t\t\tif err != nil {\n\t\t\t\treturn utils.NewToolResultError(fmt.Sprintf(\"invalid cveId: %v\", err)), nil, nil\n\t\t\t}\n\n\t\t\teco, err := OptionalParam[string](args, \"ecosystem\")","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/security_advisories.go#L74-L110","documentation":"The list_global_security_advisories tool failed to construct a go-github client. Global advisories need no repo, but the tool still requires a working client: with RequestDeps this error means the request context has no token info or the REST/upload URL derivation from configured hosts failed. It is a configuration/auth failure that happens before any Advisory Database call.","triggerScenarios":"Remote mode without Authorization on the request; GITHUB_HOST/GITHUB_ENTERPRISE_URL/GITHUB_UPLOAD_URL misconfigured so apiHosts.BaseRESTURL() or UploadURL() errors; go-github.NewClient failure.","commonSituations":"Unauthenticated HTTP transport pointed at the server; env vars set in one shell but not in the service unit/container; mixed stdio/remote configuration.","solutions":["Ensure every request carries a valid token or run stdio mode with GITHUB_PERSONAL_ACCESS_TOKEN set","Verify host-related env vars parse (full scheme + host) and point at the intended GitHub instance","Prefer BaseDeps with a pre-built client when embedding without per-request tokens"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify token + host wiring before exposing advisory tools\nif os.Getenv(\"GITHUB_PERSONAL_ACCESS_TOKEN\") == \"\" && !remoteAuthConfigured {\n    return errors.New(\"no GitHub token configured for advisory tools\")\n}\nu, err := url.Parse(getEnvOr(\"GITHUB_API_URL\", \"https://api.github.com/\"))\nif err != nil || u.Host == \"\" {\n    return errors.New(\"GITHUB_API_URL is not a valid absolute URL\")\n}","typeGuard":"func isClientSetupErr(err error) bool {\n\treturn err != nil && (strings.Contains(err.Error(), \"no token info in context\") ||\n\t\tstrings.Contains(err.Error(), \"failed to get base REST URL\"))\n}","tryCatchPattern":"client, err := deps.GetClient(ctx)\nif err != nil {\n    if isClientSetupErr(err) {\n        return nil, nil, utils.NewToolResultError(\"server auth/host misconfiguration: \" + err.Error())\n    }\n    return nil, nil, fmt.Errorf(\"failed to get GitHub client: %w\", err)\n}","preventionTips":["Construct a client once at startup to validate config before serving tools","Reject tokenless requests in remote mode before tool dispatch","Document which env vars each deployment mode actually reads"],"tags":["go","mcp","auth","configuration","security-advisory"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}