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 incorrect username/password as non-retryable (#64632)

Tom Owers1b11ca72aa3b
diff --git a/posthog/temporal/data_imports/sources/snowflake/source.py b/posthog/temporal/data_imports/sources/snowflake/source.py
index a21c4503560c..0388ced11a5b 100644
--- a/posthog/temporal/data_imports/sources/snowflake/source.py
+++ b/posthog/temporal/data_imports/sources/snowflake/source.py
@@ -196,6 +196,11 @@ class SnowflakeSource(SQLSource[SnowflakeSourceConfig]):
"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.",
+ # Snowflake error 250001 (08001): the supplied username or password is wrong, so the
+ # connector's login is rejected at connect time. Retrying can never succeed until the
+ # customer corrects the credentials. The codes, account id, and host in the message are
+ # volatile, so we match on the stable trailing phrase.
+ "Incorrect username or password was specified": "Snowflake rejected the login because the username or password is incorrect. Please check your Snowflake username and password (or switch to key-pair authentication), then resync.",
# Snowflake error 000904 (42000): the table or view we select from references a column
# that no longer exists — typically a stale view definition or a column dropped/renamed
# in the source schema. We only run `SELECT ... FROM IDENTIFIER(%s)`, so the bad identifier
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 7f3e44b65025..299247601ee8 100644
--- a/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.py
+++ b/posthog/temporal/data_imports/sources/snowflake/tests/test_snowflake.py
@@ -744,6 +744,20 @@ class TestSnowflakeSourceNonRetryableErrors:
is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())
assert is_non_retryable, f"Broken-view error should be non-retryable: {error_msg}"
+ @pytest.mark.parametrize(
+ "error_msg",
+ [
+ "Incorrect username or password was specified",
+ # The real shape from production: codes + host vary, but the substring is stable.
+ "250001 (08001): None: Failed to connect to DB: acme-xy123.snowflakecomputing.com:443. "
+ "Incorrect username or password was specified.",
+ ],
+ )
+ def test_incorrect_credentials_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"Incorrect-credentials error should be non-retryable: {error_msg}"
+
@pytest.mark.parametrize(
"error_msg",
[