From 00a4c16218b2b230de114cace319210484226788 Mon Sep 17 00:00:00 2001 From: Tom Owers Date: Thu, 30 Jul 2026 10:30:09 +0100 Subject: [PATCH] fix(data-imports): map DeltaLake object-store access errors to an actionable message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Error tracking surfaced a generic "Could not read the files from your storage bucket" exception during a MySQL sync's schema-validation step, with an underlying DeltaLake-kernel object-store access error that `ExtractErrors` had no entry for. `get_columns()`'s fallback error handler (`_safe_expose_ch_error`) matches known ClickHouse error substrings against `ExtractErrors` to give a specific, actionable message, falling back to a generic one otherwise. `ExtractErrors` only covered ClickHouse's native S3 client error vocabulary, not the different wording used by ClickHouse's DeltaLake kernel (the `object_store` Rust crate) — the format used by every warehouse_sources synced table. Added a matching entry so this error class surfaces the same actionable message as the equivalent native-S3 case. Generated-By: PostHog Code Task-Id: 5407d15d-430b-4648-b6ee-483880dcbfae --- .../warehouse_sources/backend/models/table.py | 3 +++ .../backend/tests/test_table.py | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/products/warehouse_sources/backend/models/table.py b/products/warehouse_sources/backend/models/table.py index 3bab09051b3a..42592a35878c 100644 --- a/products/warehouse_sources/backend/models/table.py +++ b/products/warehouse_sources/backend/models/table.py @@ -71,6 +71,9 @@ ExtractErrors = { "The AWS Access Key Id you provided does not exist": "The Access Key you provided does not exist", "Access Denied: while reading key:": "Access was denied when reading the provided file", + # DeltaLake-kernel object_store errors (Delta-format tables, e.g. all warehouse_sources synced + # tables) use a different vocabulary than ClickHouse's native S3 errors above. + "The operation lacked the necessary privileges to complete": "Access was denied when reading the provided file", "Could not list objects in bucket": "Access was denied to the provided bucket", "file is empty": "The provided file contains no data", "The specified key does not exist": "The provided file doesn't exist in the bucket", diff --git a/products/warehouse_sources/backend/tests/test_table.py b/products/warehouse_sources/backend/tests/test_table.py index ccfac1b19ad9..357aa8aae513 100644 --- a/products/warehouse_sources/backend/tests/test_table.py +++ b/products/warehouse_sources/backend/tests/test_table.py @@ -111,6 +111,23 @@ def test_transient_errors_without_message_are_reraised_untouched(self, err: Exce DataWarehouseTable()._safe_expose_ch_error(err) assert exc_info.value is err + def test_delta_kernel_permission_error_gets_actionable_message(self) -> None: + # Delta-format tables (the default for every warehouse_sources synced table) read via + # ClickHouse's DeltaLake kernel, whose object_store errors use different wording than + # the native ClickHouse S3 errors above. Without a matching ExtractErrors entry this + # fell through to the generic fallback message regardless of the actual cause. + delta_kernel_error = ServerException( + "DB::Exception: Received DeltaLake kernel error ObjectStoreError: Error interacting with " + "object store: The operation lacked the necessary privileges to complete for path " + "team_2_mysql_x/dw_table/_delta_log/_last_checkpoint: Error performing GET " + "http://objectstorage:19000/data-warehouse/team_2_mysql_x/dw_table/_delta_log/_last_checkpoint " + "- Server returned non-2xx status code: 403 Forbidden: AccessDenied", + code=742, # DELTA_KERNEL_ERROR + ) + + with pytest.raises(Exception, match="Access was denied when reading the provided file"): + DataWarehouseTable()._safe_expose_ch_error(delta_kernel_error) + class TestRunChdbQuery: def test_hung_query_is_killed_and_raises_instead_of_blocking(self) -> None: