{"record":{"id":"287de6137a3188a6","repo":"googleapis/mcp-toolbox","slug":"failed-to-get-cluster-w-287de6","errorCode":null,"errorMessage":"failed to get cluster: %w","messagePattern":"failed to get cluster: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/dataproc/dataproc.go","lineNumber":234,"sourceCode":"\t\t}\n\t\tclusters = append(clusters, cluster)\n\t}\n\treturn clusters, nil\n}\n\n// GetCluster gets a single cluster.\nfunc (s *Source) GetCluster(ctx context.Context, clusterName string) (any, error) {\n\tclient := s.GetClusterControllerClient()\n\n\treq := &dataprocpb.GetClusterRequest{\n\t\tProjectId:   s.Project,\n\t\tRegion:      s.Region,\n\t\tClusterName: clusterName,\n\t}\n\n\tclusterPb, err := client.GetCluster(ctx, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get cluster: %w\", err)\n\t}\n\n\tjsonBytes, err := protojson.Marshal(clusterPb)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal cluster to JSON: %w\", err)\n\t}\n\n\tvar result map[string]any\n\tif err := json.Unmarshal(jsonBytes, &result); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal cluster JSON: %w\", err)\n\t}\n\n\tconsoleUrl := ClusterConsoleURLFromProto(clusterPb, s.Region)\n\tlogsUrl := ClusterLogsURLFromProto(clusterPb, s.Region)\n\n\twrappedResult := map[string]any{\n\t\t\"consoleUrl\": consoleUrl,\n\t\t\"logsUrl\":    logsUrl,","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/dataproc/dataproc.go#L216-L252","documentation":"Thrown by the Dataproc source's GetCluster when client.GetCluster returns an error from the ClusterController GetCluster RPC. The wrapped error preserves the GCP API status (not found, permission denied, region mismatch, etc.).","triggerScenarios":"Calling get-cluster with a clusterName that doesn't exist in the configured region/project, or when the caller lacks dataproc.clusters.get permission, or the regional endpoint is unreachable.","commonSituations":"Cluster deleted (or auto-deleted after idle) before the call; cluster lives in a different region than configured; typo in cluster name; missing IAM roles.","solutions":["Verify the cluster name and that the configured region matches the cluster's actual region.","Grant roles/dataproc.viewer to the calling service account.","Check the cluster still exists (dataproc clusters list) — NOT_FOUND means it was deleted.","Inspect the wrapped (%w) gRPC status for the definitive cause."],"exampleFix":"// before: wrong region in source config\nregion: \"us-west1\" // cluster is in us-central1\n\n// after\nregion: \"us-central1\"","handlingStrategy":"try-catch","validationCode":"// confirm the cluster exists in the region before fetching\npager := iterator.NewPager(client.ListClusters(ctx, &dataprocpb.ListClustersRequest{ProjectId: project, Region: region}), 100, \"\")\nvar found bool\nvar pbs []*dataprocpb.Cluster\nfor {\n    tok, err := pager.NextPage(&pbs)\n    if err != nil { return err }\n    for _, c := range pbs { if c.ClusterName == clusterName { found = true } }\n    if found || tok == \"\" { break }\n}\nif !found { return fmt.Errorf(\"cluster %q not found in region %s\", clusterName, region) }","typeGuard":"null","tryCatchPattern":"cluster, err := src.GetCluster(ctx, clusterName)\nif err != nil {\n    if strings.Contains(err.Error(), \"NotFound\") || strings.Contains(err.Error(), \"not found\") {\n        // treat as missing resource: verify name/region, don't retry\n    }\n    return err\n}","preventionTips":["Verify cluster name and region with `gcloud dataproc clusters list` before calling.","Remember auto-deleted/idle clusters may vanish; handle NOT_FOUND gracefully.","Ensure the source config region matches the cluster's region."],"tags":["gcp","dataproc","rpc","not-found"],"backgroundTag":"gcp-resource-not-found","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"}