{"record":{"id":"a5c2b520582f1f5f","repo":"kubernetes/kops","slug":"error-creating-oauth2-service-v","errorCode":null,"errorMessage":"error creating oauth2 service: %v","messagePattern":"error creating oauth2 service: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gce/gce_cloud.go","lineNumber":415,"sourceCode":"}\n\n// logTokenInfo returns information about the active credential\nfunc (c *gceCloudImplementation) getTokenInfo(ctx context.Context) (*oauth2.Tokeninfo, error) {\n\ttokenSource, err := google.DefaultTokenSource(ctx, compute.CloudPlatformScope)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error building token source: %v\", err)\n\t}\n\n\ttoken, err := tokenSource.Token()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting token: %v\", err)\n\t}\n\n\t// Note: do not log token or any portion of it\n\n\tservice, err := oauth2.NewService(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating oauth2 service: %v\", err)\n\t}\n\n\ttokenInfo, err := service.Tokeninfo().AccessToken(token.AccessToken).Do()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error fetching oauth2 token info: %v\", err)\n\t}\n\n\treturn tokenInfo, nil\n}\n\n// SplitServiceAccountEmail splits service account email\nfunc SplitServiceAccountEmail(email string) (string, string, error) {\n\taccountID := \"\"\n\tprojectID := \"\"\n\n\ttokens := strings.Split(email, \"@\")\n\tif len(tokens) == 2 {\n\t\taccountID = tokens[0]","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gce/gce_cloud.go#L397-L433","documentation":"getTokenInfo wraps oauth2.NewService failure while building the tokeninfo service to log non-secret credential info. It fires on credential/environment problems; notably the code never logs the token itself, only service construction is affected.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/gce/gce_cloud.go:415 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check network access to googleapis.com","Inspect the wrapped error","Retry the operation"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}