{"record":{"id":"cf71515604859686","repo":"googleapis/mcp-toolbox","slug":"failed-to-call-tokeninfo-endpoint-w","errorCode":null,"errorMessage":"failed to call tokeninfo endpoint: %w","messagePattern":"failed to call tokeninfo endpoint: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/util.go","lineNumber":95,"sourceCode":"\tif useIAM {\n\t\topts = append(opts, cloudsqlconn.WithIAMAuthN())\n\t}\n\treturn opts, nil\n}\n\n// GetIAMPrincipalEmailFromADC finds the email associated with ADC\nfunc GetIAMPrincipalEmailFromADC(ctx context.Context, dbType string) (string, error) {\n\t// Finds ADC and returns an HTTP client associated with it\n\tclient, err := google.DefaultClient(ctx,\n\t\t\"https://www.googleapis.com/auth/userinfo.email\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to call userinfo endpoint: %w\", err)\n\t}\n\n\t// Retrieve the email associated with the token\n\tresp, err := client.Get(\"https://oauth2.googleapis.com/tokeninfo\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to call tokeninfo endpoint: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tbodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error reading response body %d: %s\", resp.StatusCode, string(bodyBytes))\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"tokeninfo endpoint returned non-OK status %d: %s\", resp.StatusCode, string(bodyBytes))\n\t}\n\n\t// Unmarshal response body and get `email`\n\tvar responseJSON map[string]any\n\terr = json.Unmarshal(bodyBytes, &responseJSON)\n\tif err != nil {\n\n\t\treturn \"\", fmt.Errorf(\"error parsing JSON: %v\", err)\n\t}","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/util.go#L77-L113","documentation":"The HTTP GET to oauth2.googleapis.com/tokeninfo failed after the ADC client was built — the tokeninfo endpoint was unreachable, the request timed out, or the network blocked it.","triggerScenarios":"Thrown at internal/sources/util.go:95 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check outbound network access to oauth2.googleapis.com","Retry after transient Google endpoint failures","Verify ADC token is still valid"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}