{"record":{"id":"5ae8aec690336c4e","repo":"googleapis/mcp-toolbox","slug":"failed-to-create-dataplex-datascan-client-for-proj","errorCode":null,"errorMessage":"failed to create Dataplex DataScan client for project %q: %w","messagePattern":"failed to create Dataplex DataScan client for project %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/dataplex/dataplex.go","lineNumber":235,"sourceCode":"\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()\n\t\tdataScanClient.Close()\n\t\tdataProductClient.Close()\n\t\treturn nil, nil, nil, nil, fmt.Errorf(\"failed to create ResourceManager projects client for project %q: %w\", project, err)\n\t}\n\n\treturn client, dataScanClient, dataProductClient, projectsClient, nil","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/dataplex/dataplex.go#L217-L253","documentation":"The second Dataplex client (DataScan API) is created with dataplexapi.NewDataScanClient. On failure, the already-created Catalog client is closed and this wrapped error is returned. Causes mirror the Catalog client failure: transport, options, or connectivity problems with the datascans endpoint of the Dataplex API.","triggerScenarios":"initDataplexConnection calls dataplexapi.NewDataScanClient(ctx, opts...) after a successful NewCatalogClient; failure closes the Catalog client and aborts initialization.","commonSituations":"Same network/proxy issues as the Catalog client; intermittent gRPC channel failures mid-initialization; library version mismatches between dataplex client and google.golang.org/api dependencies.","solutions":["Check connectivity to dataplex.googleapis.com (DataScan is served by the same API, so retry usually resolves transient failures).","Re-run initialization — since Catalog creation succeeded, credentials are valid; this is likely transient.","Update cloud.google.com/go/dataplex and google.golang.org/api to compatible latest versions.","Verify proxy/firewall rules aren't dropping the second concurrent gRPC connection."],"exampleFix":null,"handlingStrategy":"retry","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 DataScan client\") {\n\t\t// catalog client succeeded, so likely transient; retry after backoff\n\t\treturn backoff.Retry(func() error { _, err := cfg.Initialize(ctx, tracer); return err }, backoff.NewExponentialBackOff())\n\t}\n\treturn err\n}","preventionTips":["Retry initialization on this error with exponential backoff.","Keep dataplex and api dependencies on compatible latest versions.","Monitor for proxy connection limits that drop the second concurrent gRPC channel."],"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"}