{"record":{"id":"97867907d1b11f91","repo":"kubernetes/kops","slug":"error-getting-token-v","errorCode":null,"errorMessage":"error getting token: %v","messagePattern":"error getting token: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gce/gce_cloud.go","lineNumber":408,"sourceCode":"\t\t\tcontinue\n\t\t}\n\n\t\tmatches = append(matches, t)\n\t}\n\n\treturn matches, nil\n}\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","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gce/gce_cloud.go#L390-L426","documentation":"Wraps tokenSource.Token() failure in getTokenInfo: the token source was built but minting/fetching an actual OAuth token failed — expired credentials, revoked refresh token, or OAuth endpoint unreachable.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/gce/gce_cloud.go:408 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-authenticate with gcloud","Check refresh token validity and OAuth endpoint reachability","Inspect the wrapped error"],"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-12T07:17:12.445Z"}