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(meta_ads): stop retrying syncs with no incremental field set (#114993)

Tom Owers5b84188d6583
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/source.py
index dbf8b4fcb01a..dde381ec7d82 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/source.py
@@ -182,6 +182,15 @@ class MetaAdsSource(ResumableSource[MetaAdsSourceConfig, MetaAdsResumeConfig], O
# with a fresh cursor) can recover. `meta_ads._raise_meta_api_error` raises this
# message for that code.
META_INVALID_CURSOR_ERROR_MESSAGE: META_INVALID_CURSOR_ERROR_MESSAGE,
+ # The schema's sync type wants an incremental cursor (incremental/append) but no
+ # incremental field is stored in its config, so `meta_ads_source.get_rows` raises this
+ # before any request. The stored config stays fixed until the customer edits it, so
+ # every retry hits the same error.
+ "incremental_field and incremental_field_type can't be None": (
+ "This table is set to sync incrementally but has no incremental field selected. "
+ "Choose date_start as the incremental field in the table's sync settings, or switch "
+ "it to full refresh, then run the sync again."
+ ),
}
def get_retryable_errors(self) -> set[str]:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/test_meta_ads.py b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/test_meta_ads.py
index 34104ca96d70..3e9a74f750fb 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/test_meta_ads.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/test_meta_ads.py
@@ -1484,6 +1484,8 @@ class TestNonRetryableErrors:
# would resume with the same saved cursor and fail identically every time.
f"{META_INVALID_CURSOR_ERROR_MESSAGE} (Meta API response: 400 - "
'{"error":{"message":"(#2642) Invalid cursors values","type":"OAuthException","code":2642}})',
+ # Schema set to incremental/append with no incremental field stored in its config.
+ "incremental_field and incremental_field_type can't be None",
],
)
def test_errors_match_pattern(self, error_message: str) -> None: