Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(data-warehouse): explain a storage host the query engine won't read (#107347)

Tom Owerse9e16d453611
diff --git a/posthog/errors.py b/posthog/errors.py
index 40dcb30217b5..784507617301 100644
--- a/posthog/errors.py
+++ b/posthog/errors.py
@@ -783,7 +783,16 @@ CLICKHOUSE_ERROR_CODE_LOOKUP: dict[int, ErrorCodeMeta] = {
487: ErrorCodeMeta("CANNOT_GET_CREATE_DICTIONARY_QUERY"),
489: ErrorCodeMeta("INCORRECT_DICTIONARY_DEFINITION"),
490: ErrorCodeMeta("CANNOT_FORMAT_DATETIME"),
- 491: ErrorCodeMeta("UNACCEPTABLE_URL"),
+ # Raised when a warehouse table points at a storage host the query engine may not read.
+ # The raw ClickHouse message echoes the whole URL, which a public shared insight must not
+ # show, so carry a fixed message instead.
+ 491: ErrorCodeMeta(
+ "UNACCEPTABLE_URL",
+ user_safe=(
+ "PostHog can't read from this storage host. Check the files URL pattern on the table points at "
+ "S3, Google Cloud Storage, Cloudflare R2, or Azure Blob Storage."
+ ),
+ ),
492: ErrorCodeMeta("ACCESS_ENTITY_NOT_FOUND"),
493: ErrorCodeMeta("ACCESS_ENTITY_ALREADY_EXISTS"),
495: ErrorCodeMeta("ACCESS_STORAGE_READONLY"),
diff --git a/posthog/test/test_errors.py b/posthog/test/test_errors.py
index 1643f2457db0..4207e5974268 100644
--- a/posthog/test/test_errors.py
+++ b/posthog/test/test_errors.py
@@ -50,6 +50,12 @@ class TestWrapClickhouseQueryError:
"Cannot convert one type to another in the query. Check the types in your comparisons and IN clauses.",
),
(407, "DECIMAL_OVERFLOW", "Decimal overflow while executing query."),
+ (
+ 491,
+ "UNACCEPTABLE_URL",
+ "PostHog can't read from this storage host. Check the files URL pattern on the table points at "
+ "S3, Google Cloud Storage, Cloudflare R2, or Azure Blob Storage.",
+ ),
]
)
def test_fixed_message_codes_hide_raw_clickhouse_text(self, code: int, name: str, message: str) -> None: