{"record":{"id":"201a70a7de0a3035","repo":"googleapis/mcp-toolbox","slug":"failed-to-create-dataproc-client-w","errorCode":null,"errorMessage":"failed to create dataproc client: %w","messagePattern":"failed to create dataproc client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/dataproc/dataproc.go","lineNumber":74,"sourceCode":"\tName    string `yaml:\"name\" validate:\"required\"`\n\tType    string `yaml:\"type\" validate:\"required\"`\n\tProject string `yaml:\"project\" validate:\"required\"`\n\tRegion  string `yaml:\"region\" validate:\"required\"`\n}\n\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,","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/dataproc/dataproc.go#L56-L92","documentation":"Thrown by the Dataproc source's Config.Initialize when dataproc.NewClusterControllerClient fails to construct the ClusterController gRPC client. This wraps errors from credential resolution, endpoint dialing, or transport creation. Any prior failure prevents the source from initializing at all.","triggerScenarios":"Initialize called with invalid/missing Application Default Credentials, unreachable endpoint `<region>-dataproc.googleapis.com:443`, invalid region producing a bad endpoint, or proxy/firewall blocking gRPC traffic.","commonSituations":"Typo in the configured region (e.g., 'us-central1a'), no credentials in a container, corporate proxy blocking gRPC, Dataproc API disabled on the project.","solutions":["Verify credentials (GOOGLE_APPLICATION_CREDENTIALS or workload identity) are valid and present.","Check the region in the config is correct; the endpoint is built as `<region>-dataproc.googleapis.com:443`.","Enable the Dataproc API and ensure network/firewall/proxy allows HTTPS to the endpoint.","Inspect the wrapped cause (%w) for the exact gRPC/credential error."],"exampleFix":"// before\nregion: \"us-central11\" // invalid\n\n// after\nregion: \"us-central1\"","handlingStrategy":"validation","validationCode":"// validate region and credentials before creating the source\nvalidRegions := regexp.MustCompile(`^[a-z]+-[a-z]+\\d+$`)\nif !validRegions.MatchString(cfg.Region) {\n    return fmt.Errorf(\"invalid GCP region: %q\", cfg.Region)\n}\nif os.Getenv(\"GOOGLE_APPLICATION_CREDENTIALS\") == \"\" {\n    return errors.New(\"GCP credentials not configured\")\n}","typeGuard":"null","tryCatchPattern":"src, err := cfg.Initialize(ctx, tracer)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to create dataproc client\") {\n        // check credentials/network, possibly retry with backoff\n    }\n    return err\n}","preventionTips":["Verify the region string matches a valid Dataproc region (endpoint is `<region>-dataproc.googleapis.com:443`).","Confirm credentials before initialization (metadata server, workload identity, or key file).","Enable the Dataproc API and allow egress to the regional endpoint."],"tags":["gcp","dataproc","grpc","client-initialization"],"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"}