{"record":{"id":"44a1afc155a65495","repo":"googleapis/mcp-toolbox","slug":"failed-to-find-default-google-cloud-credentials-wi-44a1af","errorCode":null,"errorMessage":"failed to find default Google Cloud credentials with scope %q: %w","messagePattern":"failed to find default Google Cloud credentials with scope %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/looker/looker.go","lineNumber":286,"sourceCode":"\t\t\t\tBase:      transport,\n\t\t\t\tAuthToken: accessToken,\n\t\t\t\tclientIP:  clientIP,\n\t\t\t},\n\t\t}\n\t\t// return SDK with new Transport\n\t\treturn v4.NewLookerSDK(session), nil\n\t}\n\n\tif s.LookerClient() == nil {\n\t\treturn nil, fmt.Errorf(\"client id or client secret not valid\")\n\t}\n\treturn s.LookerClient(), nil\n}\n\nfunc initGoogleCloudConnection(ctx context.Context) (oauth2.TokenSource, error) {\n\tcred, err := google.FindDefaultCredentials(ctx, geminidataanalytics.DefaultAuthScopes()...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to find default Google Cloud credentials with scope %q: %w\", geminidataanalytics.DefaultAuthScopes(), err)\n\t}\n\n\treturn cred.TokenSource, nil\n}\n\nfunc (s *Source) GetHostURL(ctx context.Context, sdk *v4.LookerSDK) (string, error) {\n\tdefaultURL := strings.TrimSuffix(s.ApiSettings.BaseUrl, \"/\")\n\n\tif sdk == nil {\n\t\treturn defaultURL, nil\n\t}\n\n\t// 1. Fast path: Read lock to check cache TTL\n\ts.hostURLMu.RLock()\n\tif !s.lastFetchFailed && !s.lastFetchTime.IsZero() && time.Since(s.lastFetchTime) < 10*time.Minute {\n\t\turlStr := s.cachedHostURL\n\t\ts.hostURLMu.RUnlock()\n\t\treturn urlStr, nil","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/looker/looker.go#L268-L304","documentation":"initGoogleCloudConnection calls google.FindDefaultCredentials with the Gemini Data Analytics scopes; when Application Default Credentials cannot be located, the error is wrapped with the requested scopes. This means no workload identity, gcloud ADC, GOOGLE_APPLICATION_CREDENTIALS, or metadata-server credentials were available. It is a startup-time failure during source Initialize.","triggerScenarios":"Initialize -> initGoogleCloudConnection when the environment has no default Google Cloud credentials resolvable for the geminidataanalytics scopes (no GOOGLE_APPLICATION_CREDENTIALS, no ~/.config/gcloud ADC, no attached service account).","commonSituations":"Running the toolbox locally without `gcloud auth application-default login`; container images lacking the service-account key; GOOGLE_APPLICATION_CREDENTIALS pointing to a missing or malformed JSON file.","solutions":["Run `gcloud auth application-default login` on the host running the toolbox","Set GOOGLE_APPLICATION_CREDENTIALS to the path of a valid service-account JSON key","If on GCP, attach the service account / ensure workload identity is configured so the metadata server supplies credentials","Verify the service account has access to the Gemini Data Analytics API scopes"],"exampleFix":"// before (shell)\ngo run .\n// after\nexport GOOGLE_APPLICATION_CREDENTIALS=/path/to/sa.json\ngo run .","handlingStrategy":"validation","validationCode":"_, err := google.FindDefaultCredentials(context.Background(), geminidataanalytics.DefaultAuthScopes()...)\nif err != nil {\n    return fmt.Errorf(\"no ADC available: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"ts, err := initGoogleCloudConnection(ctx)\nif err != nil {\n    // check GOOGLE_APPLICATION_CREDENTIALS and run gcloud auth application-default login\n    return fmt.Errorf(\"google auth bootstrap failed: %w\", err)\n}","preventionTips":["Run `gcloud auth application-default login` on dev machines before starting the toolbox","Bake service-account keys or workload identity into container deployments","Health-check credential availability at process startup"],"tags":["gcp","authentication","adc","credentials"],"backgroundTag":"missing-google-cloud-credentials","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"}