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(snowflake): classify proxy-502 backend connection failure as retryable (#90692)

Tom Owers9d0ca1db5b27
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/source.py
index 446a801772d6..81912d5f186e 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/source.py
@@ -337,6 +337,12 @@ class SnowflakeSource(SQLSource[SnowflakeSourceConfig]):
# self-recovering failure it is. The request id in brackets is volatile, so we match the
# stable phrase.
"Internal error:",
+ # Snowflake error 250001 (08001): the connector exhausted its internal login retry budget
+ # (default 11 attempts) because an HTTP proxy returned 502 Bad Gateway when tunneling to
+ # the Snowflake login endpoint. A recovered proxy or transient network blip resolves it,
+ # so Temporal-level retries will eventually succeed. The attempt count is volatile, so we
+ # match the stable prefix.
+ "Could not connect to Snowflake backend after",
}
def reconcile_schema_metadata(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py
index fcc206c7d088..6eb562081466 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py
@@ -914,6 +914,9 @@ class TestSnowflakeSourceNonRetryableErrors:
[
"250003 (08001): Failed to connect to DB: acme-xy123.snowflakecomputing.com:443. Connection timed out",
"Operation timed out while waiting for the warehouse to resume",
+ # 502 proxy failure exhausting the connector's internal retry budget — transient, not a
+ # user config error; the retry count varies so only the stable prefix is matched.
+ "250001: 250001: Could not connect to Snowflake backend after 11 attempt(s).Aborting",
],
)
def test_transient_errors_are_retryable(self, source, error_msg):
@@ -955,6 +958,14 @@ class TestSnowflakeSourceRetryableErrors:
is_retryable = any(pattern in error_msg for pattern in retryable)
assert is_retryable, f"Snowflake login internal-error should be classified retryable: {error_msg}"
+ def test_backend_connection_failure_after_retries_is_retryable(self, source):
+ # The real shape from production: the connector exhausted its 11-attempt login retry budget
+ # after a proxy returned 502 Bad Gateway. The attempt count is volatile; the stable prefix is matched.
+ error_msg = "250001: 250001: Could not connect to Snowflake backend after 11 attempt(s).Aborting"
+ retryable = source.get_retryable_errors()
+ is_retryable = any(pattern in error_msg for pattern in retryable)
+ assert is_retryable, f"Proxy-502 backend-connection failure should be classified retryable: {error_msg}"
+
class TestSnowflakeValidateCredentials:
@pytest.fixture