{"record":{"id":"5e42ab73e22aafa1","repo":"googleapis/mcp-toolbox","slug":"failed-to-create-longrunning-client-w","errorCode":null,"errorMessage":"failed to create longrunning client: %w","messagePattern":"failed to create longrunning client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/dataproc/dataproc.go","lineNumber":79,"sourceCode":"\nfunc (r Config) SourceConfigType() string {\n\treturn SourceType\n}\n\nfunc (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {\n\tua, err := util.UserAgentFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error in User Agent retrieval: %s\", err)\n\t}\n\tendpoint := fmt.Sprintf(\"%s-dataproc.googleapis.com:443\", r.Region)\n\tclient, err := dataproc.NewClusterControllerClient(ctx, option.WithEndpoint(endpoint), option.WithUserAgent(ua))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create dataproc client: %w\", err)\n\t}\n\topsClient, err := longrunning.NewOperationsClient(ctx, option.WithEndpoint(endpoint), option.WithUserAgent(ua))\n\tif err != nil {\n\t\tclient.Close()\n\t\treturn nil, fmt.Errorf(\"failed to create longrunning client: %w\", err)\n\t}\n\tjobClient, err := dataproc.NewJobControllerClient(ctx, option.WithEndpoint(endpoint), option.WithUserAgent(ua))\n\tif err != nil {\n\t\tclient.Close()\n\t\topsClient.Close()\n\t\treturn nil, fmt.Errorf(\"failed to create dataproc job client: %w\", err)\n\t}\n\n\ts := &Source{\n\t\tConfig:    r,\n\t\tClient:    client,\n\t\tOpsClient: opsClient,\n\t\tJobClient: jobClient,\n\t}\n\treturn s, nil\n}\n\nvar _ sources.Source = &Source{}","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/dataproc/dataproc.go#L61-L97","documentation":"Thrown by the Dataproc source's Config.Initialize when longrunning.NewOperationsClient fails after the cluster controller client was created successfully. The code closes the already-created cluster client before returning to avoid leaks. The wrap preserves the underlying transport or auth error.","triggerScenarios":"The Dataproc ClusterControllerClient was created, but the Long Running Operations client creation to the same `<region>-dataproc.googleapis.com:443` endpoint fails — typically due to transient network errors, credential issues surfacing late, or service unavailability.","commonSituations":"Transient network drops between the two client creations; regional endpoint outage; IAM/token revocation mid-initialization; resource limits exhausting connections.","solutions":["Retry initialization — this often follows transient network issues.","Verify network connectivity to `<region>-dataproc.googleapis.com:443`.","Re-check credentials; inspect the wrapped (%w) cause for the exact error.","Confirm the Dataproc API and regional endpoint are healthy for the configured region."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"var src sources.Source\nerr := retry.Do(func() error {\n    var e error\n    src, e = cfg.Initialize(ctx, tracer)\n    return e\n}, retry.Attempts(3), retry.Delay(time.Second))\nif err != nil && strings.Contains(err.Error(), \"longrunning client\") {\n    // transient network: alert and surface to user\n}","preventionTips":["Initialize once at startup on a stable network rather than per-request.","Add retry-with-backoff around source initialization.","Monitor regional endpoint health for the configured region."],"tags":["gcp","dataproc","grpc","longrunning-operations"],"backgroundTag":"gcp-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"}