{"record":{"id":"9712b05296273426","repo":"googleapis/mcp-toolbox","slug":"failed-to-delete-cluster-w","errorCode":null,"errorMessage":"failed to delete cluster: %w","messagePattern":"failed to delete cluster: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/bigtable/admin_wrappers.go","lineNumber":126,"sourceCode":"\terr := s.InstanceAdmin.CreateCluster(ctx, conf)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create cluster: %w\", err)\n\t}\n\treturn map[string]string{\"status\": \"cluster created successfully\"}, nil\n}\n\nfunc (s *Source) UpdateCluster(ctx context.Context, instanceId, clusterId string, serveNodes int32) (any, error) {\n\terr := s.InstanceAdmin.UpdateCluster(ctx, instanceId, clusterId, serveNodes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to update cluster: %w\", err)\n\t}\n\treturn map[string]string{\"status\": \"cluster updated successfully\"}, nil\n}\n\nfunc (s *Source) DeleteCluster(ctx context.Context, instanceId, clusterId string) (any, error) {\n\terr := s.InstanceAdmin.DeleteCluster(ctx, instanceId, clusterId)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to delete cluster: %w\", err)\n\t}\n\treturn map[string]string{\"status\": \"cluster deleted successfully\"}, nil\n}\n\nfunc (s *Source) GetTable(ctx context.Context, tableId string) (any, error) {\n\ttable, err := s.Admin.TableInfo(ctx, tableId)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get table: %w\", err)\n\t}\n\treturn table, nil\n}\n\nfunc (s *Source) CreateTable(ctx context.Context, tableId, columnFamily string) (any, error) {\n\terr := s.Admin.CreateTable(ctx, tableId)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create table: %w\", err)\n\t}\n\tif columnFamily != \"\" {","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/bigtable/admin_wrappers.go#L108-L144","documentation":"This error wraps any failure from the Bigtable InstanceAdmin DeleteCluster call inside Source.DeleteCluster. The library wraps the underlying API error with fmt.Errorf(\"failed to delete cluster: %w\", err) so the root cause (not found, permissions, last remaining cluster) stays intact. Check the wrapped gRPC error for the actual status.","triggerScenarios":"Calling the bigtable delete_cluster tool where s.InstanceAdmin.DeleteCluster(ctx, instanceId, clusterId) errors: cluster ID does not exist, attempting to delete the last cluster of an instance (not allowed), insufficient IAM permissions (bigtable.clusters.delete), or a transient gRPC/network failure.","commonSituations":"Deleting an already-deleted or mistyped cluster; trying to remove the final cluster in an instance (Bigtable requires at least one); service account lacking Bigtable Admin; dependency-locked clusters referenced by logical views or backups.","solutions":["Confirm the cluster still exists and the ID is correct before deleting (it is an idempotency question — NotFound often means it is already gone).","If it is the last cluster in the instance, add another cluster first or delete the whole instance instead.","Grant the caller roles/bigtable.admin or bigtable.clusters.delete permission.","Check for backups/views blocking deletion; treat gRPC Unavailable/DeadlineExceeded as retryable with backoff."],"exampleFix":"// before: undifferentiated handling\nreturn nil, fmt.Errorf(\"failed to delete cluster: %w\", err)\n// after: treat NotFound as already-deleted\nif code := status.Code(err); code == codes.NotFound {\n    return map[string]string{\"status\": \"cluster already deleted\"}, nil\n}","handlingStrategy":"try-catch","validationCode":"// Go: confirm cluster exists before delete\nclusters, err := listClusters(ctx, instanceId)\nif err == nil && !slices.Contains(clusters, clusterId) {\n    return nil // nothing to delete\n}","typeGuard":"func isAlreadyGone(err error) bool {\n    return status.Code(err) == codes.NotFound\n}","tryCatchPattern":"if err := src.DeleteCluster(ctx, inst, cluster); err != nil {\n    if status.Code(err) == codes.NotFound {\n        return nil // idempotent success\n    }\n    if status.Code(err) == codes.FailedPrecondition {\n        return fmt.Errorf(\"cannot delete last cluster; %v\", err)\n    }\n    return fmt.Errorf(\"delete cluster: %w\", err)\n}","preventionTips":["Treat NotFound as success in cleanup/idempotent scripts.","Never delete the last cluster of an instance; delete the instance instead.","Check for dependent backups or logical views before deleting.","Use a service account with bigtable.clusters.delete granted."],"tags":["gcp","bigtable","grpc","iam","admin-api"],"backgroundTag":"gcp-grpc-admin-operation-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"}