: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 disabled user account as non-retryable (#63157)
Tom Owers5de47db0c9f2
diff --git a/posthog/temporal/data_imports/sources/snowflake/source.py b/posthog/temporal/data_imports/sources/snowflake/source.pyindex 1ddb681230be..6d32269bb821 100644--- a/posthog/temporal/data_imports/sources/snowflake/source.py+++ b/posthog/temporal/data_imports/sources/snowflake/source.py@@ -176,6 +176,9 @@ class SnowflakeSource(SQLSource[SnowflakeSourceConfig]):"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.",+ # Snowflake error 250001: the user account was disabled by the customer's Snowflake admin+ # (e.g. `ALTER USER ... SET DISABLED = TRUE`). Retrying can never succeed until they re-enable it.+ "User access disabled. Contact your local system administrator": "Your Snowflake user account has been disabled. Please contact your Snowflake administrator to re-enable it, then resync.","MFA authentication is required": None,"invalid credentials": "Snowflake authentication failed. Please check your username, password, and account details.","authentication failed": "Snowflake authentication failed. Please check your username, password, and account details.",diff --git a/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.py b/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.pyindex 1f140d5c01d6..a9c37e060da1 100644--- a/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.py+++ b/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.py@@ -14,6 +14,7 @@ from posthog.temporal.data_imports.sources.snowflake.snowflake import (_split_display_name,filter_snowflake_incremental_fields,)+from posthog.temporal.data_imports.sources.snowflake.source import SnowflakeSourcefrom products.data_warehouse.backend.types import IncrementalFieldType@@ -541,3 +542,33 @@ class TestBuildPipeline:assert pk_param == ("DB.analytics.users",)stream_param = streaming_cursor.execute.call_args.args[1]assert stream_param == ("DB.analytics.users",)+++class TestSnowflakeSourceNonRetryableErrors:+ @pytest.fixture+ def source(self):+ return SnowflakeSource()++ @pytest.mark.parametrize(+ "error_msg",+ [+ "250001 (08001): None: Failed to connect to DB: acme-xy123.snowflakecomputing.com:443. User access disabled. Contact your local system administrator.",+ "User access disabled. Contact your local system administrator.",+ ],+ )+ def test_disabled_user_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"Disabled-user error should be non-retryable: {error_msg}"++ @pytest.mark.parametrize(+ "error_msg",+ [+ "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",+ ],+ )+ def test_transient_errors_are_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 not is_non_retryable, f"Error should remain retryable: {error_msg}"