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(warehouse-sources): recognize MariaDB's host-not-allowed wording as non-retryable (#98913)

Tom Owers13a29f12fabc
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py
index bd74f23e5580..b2e2377fe46f 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py
@@ -306,8 +306,11 @@ class MySQLSource(SQLSource[MySQLSourceConfig], SSHTunnelMixin, ValidateDatabase
# PostHog's connecting host, so the handshake is rejected before any credentials are
# checked. Only a DB admin can fix this server-side (GRANT for the host, or allow our
# egress / SSH-tunnel host) — retrying connects from the same host fails identically.
- # Match the stable tail phrase, not the volatile host in the message prefix.
- "is not allowed to connect to this MySQL server": "Your MySQL/MariaDB server isn't allowing connections from PostHog's host (error 1130). Ask your database admin to grant access for the connecting host (or allow our IP / SSH-tunnel host), then retry the sync.",
+ # Match the stable tail phrase, not the volatile host in the message prefix, and not the
+ # vendor name that follows it: MariaDB renders this same error as "...this MariaDB
+ # server", not "...this MySQL server", so anchoring on the vendor name missed every
+ # MariaDB server.
+ "is not allowed to connect to this": "Your MySQL/MariaDB server isn't allowing connections from PostHog's host (error 1130). Ask your database admin to grant access for the connecting host (or allow our IP / SSH-tunnel host), then retry the sync.",
# MySQL/MariaDB error 1226 (ER_USER_LIMIT_REACHED): the connecting user account has a
# `MAX_CONNECTIONS_PER_HOUR` resource limit set (via `CREATE USER`/`GRANT ... WITH
# MAX_CONNECTIONS_PER_HOUR`), and this hour's quota is used up. The counter only resets
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py
index 3a1cbf22d8d4..3239c39ea510 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py
@@ -2228,6 +2228,13 @@ class TestMySQLSourceNonRetryableErrors:
),
# Temporal-wrapped str(e.cause) form — different host, same stable phrase.
"OperationalError: (1130, \"Host '10.0.1.5' is not allowed to connect to this MySQL server\")",
+ # MariaDB renders the same error naming itself, not "MySQL server".
+ str(
+ pymysql.err.OperationalError(
+ 1130,
+ "Host 'ec2-203-0-113-42.compute-1.amazonaws.com' is not allowed to connect to this MariaDB server",
+ )
+ ),
],
)
def test_host_not_privileged_is_non_retryable(self, source, error_msg):