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): treat Duo Security MFA denial as non-retryable (#63053)

Tom Owersb6245760011e
diff --git a/posthog/temporal/data_imports/sources/snowflake/source.py b/posthog/temporal/data_imports/sources/snowflake/source.py
index 6d32269bb821..1ceb41e11193 100644
--- a/posthog/temporal/data_imports/sources/snowflake/source.py
+++ b/posthog/temporal/data_imports/sources/snowflake/source.py
@@ -180,6 +180,10 @@ class SnowflakeSource(SQLSource[SnowflakeSourceConfig]):
# (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,
+ # The account enforces Duo Security multi-factor auth for this user, so the
+ # connector's login is rejected (250001 / 08001). An unattended sync can't answer a
+ # Duo push, so retrying never succeeds — surface an actionable message instead.
+ "Duo Security authentication is denied": "Snowflake rejected the login because multi-factor authentication (Duo Security) is enforced for this user. Automated syncs can't answer an MFA prompt — connect with a service user that uses key-pair authentication or is exempt from MFA.",
"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.",
# Raised from the shared `evolve_pyarrow_schema` in `pipelines/pipeline/utils.py`
diff --git a/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.py b/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.py
index a9c37e060da1..1ae0a141bcfc 100644
--- a/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.py
+++ b/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.py
@@ -479,6 +479,22 @@ class TestGetRowsToSync:
# ---------------------------------------------------------------------------
+class TestSnowflakeSourceNonRetryableErrors:
+ @pytest.mark.parametrize(
+ "error_msg",
+ [
+ "Duo Security authentication is denied",
+ # The real shape from production: codes + host vary, but the Duo substring is stable.
+ "250001 (08001): None: Failed to connect to DB: wv65496-re80354.snowflakecomputing.com:443. "
+ "Duo Security authentication is denied.",
+ ],
+ )
+ def test_duo_security_denied_is_non_retryable(self, error_msg):
+ non_retryable = SnowflakeSource().get_non_retryable_errors()
+ is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())
+ assert is_non_retryable
+
+
class TestBuildPipeline:
def test_builds_source_response_and_streams(self, impl):
# Two separate cursors: one for metadata pass, one for streaming.