{"record":{"id":"74eb3c822a5e5621","repo":"googleapis/mcp-toolbox","slug":"failed-to-delete-table-w","errorCode":null,"errorMessage":"failed to delete table: %w","messagePattern":"failed to delete table: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/bigtable/admin_wrappers.go","lineNumber":155,"sourceCode":"}\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 != \"\" {\n\t\tif err := s.Admin.CreateColumnFamily(ctx, tableId, columnFamily); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create column family: %w\", err)\n\t\t}\n\t}\n\treturn map[string]string{\"status\": \"table created successfully\"}, nil\n}\n\nfunc (s *Source) DeleteTable(ctx context.Context, tableId string) (any, error) {\n\terr := s.Admin.DeleteTable(ctx, tableId)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to delete table: %w\", err)\n\t}\n\treturn map[string]string{\"status\": \"table deleted successfully\"}, nil\n}\n\nfunc (s *Source) ListTables(ctx context.Context) (any, error) {\n\ttables, err := s.Admin.Tables(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list tables: %w\", err)\n\t}\n\treturn tables, nil\n}\n\nfunc (s *Source) UpdateTable(ctx context.Context, tableId string, disableChangeStream bool) (any, error) {\n\tvar err error\n\tif disableChangeStream {\n\t\terr = s.Admin.UpdateTableDisableChangeStream(ctx, tableId)\n\t} else {\n\t\terr = s.Admin.UpdateTableWithChangeStream(ctx, tableId, 24*time.Hour)","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/bigtable/admin_wrappers.go#L137-L173","documentation":"This error wraps failures from the Bigtable Admin client's DeleteTable call in Source.DeleteTable. The library wraps the underlying error with fmt.Errorf(\"failed to delete table: %w\", err) while preserving the original gRPC cause (not found, permissions, network) in the wrapped chain.","triggerScenarios":"Calling the bigtable delete_table tool where s.Admin.DeleteTable(ctx, tableId) errors: tableId does not exist, caller lacks bigtable.tables.delete IAM permission, the table is protected by an active backup/authorization, or a transient gRPC failure occurs.","commonSituations":"Deleting an already-deleted table in idempotent cleanup scripts; typos in table IDs; service account with viewer-only rights; delete blocked because the table is in a backup schedule or logical view in some setups.","solutions":["Confirm tableId exists via list_tables; treat gRPC NotFound as already deleted for idempotency.","Check IAM: caller needs roles/bigtable.admin (or bigtable.tables.delete).","Remove or account for backups/authorized views that pin the table, then retry.","Retry transient gRPC errors (Unavailable/DeadlineExceeded) with exponential backoff."],"exampleFix":"// before\nreturn nil, fmt.Errorf(\"failed to delete table: %w\", err)\n// after: idempotent delete\nif code := status.Code(err); code == codes.NotFound {\n    return map[string]string{\"status\": \"table already deleted\"}, nil\n}","handlingStrategy":"try-catch","validationCode":"// Go: confirm the table exists before delete\ntables, err := admin.Tables(ctx)\nif err == nil && !slices.Contains(tables, tableId) {\n    return nil // already deleted\n}","typeGuard":"func isTableGone(err error) bool {\n    return status.Code(err) == codes.NotFound\n}","tryCatchPattern":"if err := src.DeleteTable(ctx, tableId); err != nil {\n    if status.Code(err) == codes.NotFound {\n        return nil // idempotent success\n    }\n    return fmt.Errorf(\"delete table: %w\", err)\n}","preventionTips":["Make deletes idempotent by swallowing NotFound.","List tables before bulk deletions to catch typos early.","Check for backups/authorized views that may block deletion.","Use a service account with bigtable.tables.delete (roles/bigtable.admin)."],"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"}