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(postgres): treat SSH gateway failures as non-retryable (#56473)

Tom Owersbb960466bd05
diff --git a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_retention_metric.ambr b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_retention_metric.ambr
index 6e3e02487e21..fedf3b4f3125 100644
--- a/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_retention_metric.ambr
+++ b/posthog/hogql_queries/experiments/test/experiment_query_runner/__snapshots__/test_retention_metric.ambr
@@ -394,7 +394,6 @@
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=39728447488,
- enable_analyzer=1,
transform_null_in=1,
optimize_min_equality_disjunction_chain_length=4294967295,
allow_experimental_join_condition=1,
@@ -466,7 +465,6 @@
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=39728447488,
- enable_analyzer=1,
transform_null_in=1,
optimize_min_equality_disjunction_chain_length=4294967295,
allow_experimental_join_condition=1,
diff --git a/posthog/temporal/data_imports/external_data_job.py b/posthog/temporal/data_imports/external_data_job.py
index 9c0b1477c35d..4ba18f61f9ee 100644
--- a/posthog/temporal/data_imports/external_data_job.py
+++ b/posthog/temporal/data_imports/external_data_job.py
@@ -132,7 +132,7 @@ async def update_external_data_job_model(inputs: UpdateExternalDataJobStatusInpu
if len(non_retryable_errors) == 0:
non_retryable_errors = Any_Source_Errors
else:
- non_retryable_errors = {**non_retryable_errors, **Any_Source_Errors}
+ non_retryable_errors = {**Any_Source_Errors, **non_retryable_errors}
has_non_retryable_error = any(error in internal_error_normalized for error in non_retryable_errors.keys())
if has_non_retryable_error:
diff --git a/posthog/temporal/data_imports/sources/postgres/source.py b/posthog/temporal/data_imports/sources/postgres/source.py
index 0632a658a670..0b505624215c 100644
--- a/posthog/temporal/data_imports/sources/postgres/source.py
+++ b/posthog/temporal/data_imports/sources/postgres/source.py
@@ -165,6 +165,7 @@ class PostgresSource(SimpleSource[PostgresSourceConfig], SSHTunnelMixin, Validat
"connection timeout expired": None,
"SSLRequiredError": None,
"SSL/TLS connection is required": None,
+ "Could not establish session to SSH gateway": None,
"DiskFull": "Source database ran out of disk space. Free up disk space on your database server or add an index on your incremental field to reduce temp file usage.",
"No space left on device": "Source database ran out of disk space. Free up disk space on your database server or add an index on your incremental field to reduce temp file usage.",
# Raised when a Postgres numeric value cannot be represented in any Delta-compatible
diff --git a/posthog/temporal/data_imports/sources/postgres/test_postgres.py b/posthog/temporal/data_imports/sources/postgres/test_postgres.py
index 22b8359a50f4..bd9656a82bf0 100644
--- a/posthog/temporal/data_imports/sources/postgres/test_postgres.py
+++ b/posthog/temporal/data_imports/sources/postgres/test_postgres.py
@@ -118,6 +118,7 @@ class TestPostgresSourceNonRetryableErrors:
'FATAL: password authentication failed for user "myuser"',
'FATAL: no such database "nonexistent_db"',
"Name or service not known",
+ "BaseSSHTunnelForwarderError: Could not establish session to SSH gateway",
],
)
def test_permanent_connection_errors_are_non_retryable(self, source, error_msg):