googleapis/mcp-toolbox · error
failed to create longrunning client: %w
Error message
failed to create longrunning client: %w
What it means
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.
Source
Thrown at internal/sources/dataproc/dataproc.go:79
func (r Config) SourceConfigType() string {
return SourceType
}
func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {
ua, err := util.UserAgentFromContext(ctx)
if err != nil {
return nil, fmt.Errorf("error in User Agent retrieval: %s", err)
}
endpoint := fmt.Sprintf("%s-dataproc.googleapis.com:443", r.Region)
client, err := dataproc.NewClusterControllerClient(ctx, option.WithEndpoint(endpoint), option.WithUserAgent(ua))
if err != nil {
return nil, fmt.Errorf("failed to create dataproc client: %w", err)
}
opsClient, err := longrunning.NewOperationsClient(ctx, option.WithEndpoint(endpoint), option.WithUserAgent(ua))
if err != nil {
client.Close()
return nil, fmt.Errorf("failed to create longrunning client: %w", err)
}
jobClient, err := dataproc.NewJobControllerClient(ctx, option.WithEndpoint(endpoint), option.WithUserAgent(ua))
if err != nil {
client.Close()
opsClient.Close()
return nil, fmt.Errorf("failed to create dataproc job client: %w", err)
}
s := &Source{
Config: r,
Client: client,
OpsClient: opsClient,
JobClient: jobClient,
}
return s, nil
}
var _ sources.Source = &Source{}View on GitHub (pinned to 8cc6e09de2)
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.
Defensive patterns
Strategy: retry
Validate before calling
null
Type guard
null
Try / catch
var src sources.Source
err := retry.Do(func() error {
var e error
src, e = cfg.Initialize(ctx, tracer)
return e
}, retry.Attempts(3), retry.Delay(time.Second))
if err != nil && strings.Contains(err.Error(), "longrunning client") {
// transient network: alert and surface to user
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Transient network drops between the two client creations; regional endpoint outage; IAM/token revocation mid-initialization; resource limits exhausting connections.
Related errors
- failed to create dataproc client: %w
- failed to create dataproc job client: %w
- failed to create Dataplex client for project %q: %w
- failed to get instance: %w
- failed to update instance: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/5e42ab73e22aafa1.
Report an issue: GitHub.