: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(snowflake): treat no-active-warehouse error as non-retryable (#63673)
Tom Owers3b91aa396f71
diff --git a/posthog/temporal/data_imports/sources/snowflake/source.py b/posthog/temporal/data_imports/sources/snowflake/source.pyindex eced3e024e8f..9b2ffba6b67b 100644--- a/posthog/temporal/data_imports/sources/snowflake/source.py+++ b/posthog/temporal/data_imports/sources/snowflake/source.py@@ -175,6 +175,11 @@ class SnowflakeSource(SQLSource[SnowflakeSourceConfig]):def get_non_retryable_errors(self) -> dict[str, str | None]:return {"This account has been marked for decommission": "Your Snowflake account has been suspended or trial has ended. Please check your account status.",+ # Snowflake error 000606 (57P03): the session has no active warehouse, so the first query+ # needing compute fails. The connector doesn't fail at connect time even when the configured+ # warehouse is missing/suspended or the role lacks USAGE on it — it just leaves the session+ # warehouse unset. Retrying can never succeed until the customer fixes the grant or warehouse.+ "No active warehouse selected in the current session": "No active warehouse is available for this connection. Check that the configured warehouse exists, is running, and that the connecting role has USAGE on it, then resync.","404 Not Found": None,"Your free trial has ended": "Your Snowflake account has been suspended or trial has ended. Please check your account status.","Your account is suspended due to lack of payment method": "Your Snowflake account has been suspended or trial has ended. Please check your account status.",diff --git a/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.py b/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.pyindex b80b16c62193..c448e206455e 100644--- a/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.py+++ b/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.py@@ -577,6 +577,20 @@ class TestSnowflakeSourceNonRetryableErrors:is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())assert is_non_retryable, f"Duo-denied error should be non-retryable: {error_msg}"+ @pytest.mark.parametrize(+ "error_msg",+ [+ "No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command.",+ # The real shape from production: the query id varies, but the warehouse substring is stable.+ "000606 (57P03): 01c51211-0105-f139-0002-113a46e58fba: No active warehouse selected in the current "+ "session. Select an active warehouse with the 'use warehouse' command.",+ ],+ )+ def test_no_active_warehouse_is_non_retryable(self, source, error_msg):+ non_retryable = source.get_non_retryable_errors()+ is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())+ assert is_non_retryable, f"No-active-warehouse error should be non-retryable: {error_msg}"+@pytest.mark.parametrize("error_msg",[