{"record":{"id":"4e0d6a7c49f853aa","repo":"googleapis/mcp-toolbox","slug":"failed-to-create-dataplex-client-for-project-q-4e0d6a","errorCode":null,"errorMessage":"failed to create Dataplex client for project %q: %w","messagePattern":"failed to create Dataplex client for project %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/dataplex/dataplex.go","lineNumber":229,"sourceCode":"\t\topts = []option.ClientOption{\n\t\t\toption.WithUserAgent(userAgent),\n\t\t\toption.WithTokenSource(ts),\n\t\t}\n\t} else {\n\t\t// Use default credentials\n\t\tcred, err := google.FindDefaultCredentials(ctx, credScopes...)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, nil, fmt.Errorf(\"failed to find default Google Cloud credentials for project %q: %w\", project, err)\n\t\t}\n\t\topts = []option.ClientOption{\n\t\t\toption.WithUserAgent(userAgent),\n\t\t\toption.WithCredentials(cred),\n\t\t}\n\t}\n\n\tclient, err := dataplexapi.NewCatalogClient(ctx, opts...)\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, fmt.Errorf(\"failed to create Dataplex client for project %q: %w\", project, err)\n\t}\n\n\tdataScanClient, err := dataplexapi.NewDataScanClient(ctx, opts...)\n\tif err != nil {\n\t\tclient.Close()\n\t\treturn nil, nil, nil, nil, fmt.Errorf(\"failed to create Dataplex DataScan client for project %q: %w\", project, err)\n\t}\n\n\tdataProductClient, err := dataplexapi.NewDataProductClient(ctx, opts...)\n\tif err != nil {\n\t\tclient.Close()\n\t\tdataScanClient.Close()\n\t\treturn nil, nil, nil, nil, fmt.Errorf(\"failed to create Dataplex DataProduct client for project %q: %w\", project, err)\n\t}\n\n\tprojectsClient, err := resourcemanager.NewProjectsClient(ctx, opts...)\n\tif err != nil {\n\t\tclient.Close()","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/dataplex/dataplex.go#L211-L247","documentation":"After resolving client options (impersonated or default credentials), the source constructs the Dataplex Catalog client with dataplexapi.NewCatalogClient. This error wraps that constructor's failure, which is typically a transport/endpoint or credential-option problem rather than a project-level permission issue. No other clients exist yet, so nothing else needs closing on this path.","triggerScenarios":"initDataplexConnection calls dataplexapi.NewCatalogClient(ctx, opts...) and it errors — usually due to invalid client options, unreachable dataplex.googleapis.com endpoint, or gRPC transport setup failure.","commonSituations":"Corporate proxy blocking dataplex.googleapis.com; custom GOOGLE_API_USE_MTLS_ENDPOINT or emulator env misconfiguration; corrupted ADC credentials object passed via option.WithCredentials; out-of-date cloud.google.com/go/dataplex library.","solutions":["Verify network access to dataplex.googleapis.com (DNS, firewall, proxy) from the host running the toolbox.","Re-authenticate: refresh ADC (`gcloud auth application-default login`) or fix the credentials file, then retry.","Update cloud.google.com/go/dataplex to the latest version.","Unset conflicting env vars (GOOGLE_API_USE_MTLS_ENDPOINT, endpoint overrides) unless intentionally configured.","If impersonation was just added, first confirm the impersonated token source works (fix error 693 first)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"curl -sS --max-time 5 https://dataplex.googleapis.com/ >/dev/null && echo reachable || echo unreachable","typeGuard":null,"tryCatchPattern":"src, err := cfg.Initialize(ctx, tracer)\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to create Dataplex client\") {\n\t\tlog.Printf(\"transient Dataplex client failure, retrying: %v\", err)\n\t\treturn retryWithBackoff(func() error { _, err := cfg.Initialize(ctx, tracer); return err })\n\t}\n\treturn err\n}","preventionTips":["Whitelist dataplex.googleapis.com in firewalls/proxies.","Keep cloud.google.com/go/dataplex updated.","Avoid ad-hoc endpoint/mtls env overrides unless required.","Confirm Dataplex API is enabled: `gcloud services enable dataplex.googleapis.com`."],"tags":["gcp","dataplex","client-construction","network","initialization"],"backgroundTag":"api-client-creation-failed","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"}