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(data-imports): treat unparseable source config as non-retryable in import (#68830)

Tom Owersc6ccdc0921f5
diff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py
index 0403b4f679c2..181523717c2f 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py
@@ -217,7 +217,15 @@ async def import_data_activity_sync(inputs: ImportDataActivityInputs) -> Pipelin
)
new_source = SourceRegistry.get_source(source_type)
- config = new_source.parse_config(model.pipeline.job_inputs)
+
+ try:
+ config = new_source.parse_config(model.pipeline.job_inputs)
+ except Exception as e:
+ # A stored config that can't be parsed (corrupt or double-encoded `job_inputs`)
+ # fails identically on every attempt — there is nothing to retry. Treat it as
+ # non-retryable so the job gives up cleanly instead of crash-looping and spamming
+ # error tracking. Mirrors the skip in `sync_new_schemas_activity`.
+ await handle_non_retryable_error(job_inputs, str(e), logger, e)
resumable_source_manager: ResumableSourceManager | None = None
try:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_import_data_sync.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_import_data_sync.py
index ca2a452ef51b..37bd285903e1 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_import_data_sync.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_import_data_sync.py
@@ -111,6 +111,25 @@ async def test_retryable_setup_error_is_reraised():
handle_mock.assert_not_awaited()
+async def test_unparseable_config_routes_through_handler():
+ # A corrupt / double-encoded stored config makes parse_config raise deterministically before
+ # source setup. It must be treated as non-retryable instead of crash-looping on every attempt.
+ error = ValueError("invalid literal for int() with base 10: 'not-an-int'")
+ source = mock.MagicMock(spec=SimpleSource)
+ source.parse_config.side_effect = error
+ source.get_non_retryable_errors.return_value = {}
+
+ with _patched_activity(source) as handle_mock:
+ handle_mock.side_effect = NonRetryableException()
+ with pytest.raises(NonRetryableException):
+ await import_data_activity_sync(_inputs())
+
+ handle_mock.assert_awaited_once()
+ assert handle_mock.await_args.args[3] is error
+ source.source_for_pipeline.assert_not_called()
+
+
def _incremental_schema(*, is_incremental: bool, lookback_seconds: int | None) -> mock.MagicMock:
schema = mock.MagicMock()
schema.should_use_incremental_field = True