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): classify ActiveCampaign 402 as non-retryable (#74619)

Tom Owers2bdae51bac30
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/active_campaign/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/active_campaign/source.py
index 4eeac45030cb..68837974a49f 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/active_campaign/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/active_campaign/source.py
@@ -86,6 +86,9 @@ You can find both in your ActiveCampaign account under **Settings > Developer**.
"401 Client Error": "Invalid ActiveCampaign credentials. Please check your API URL and key and reconnect.",
"403 Client Error": "Access forbidden. Please check that your ActiveCampaign API key is valid and reconnect.",
"Unauthorized for url": "Invalid ActiveCampaign credentials. Please check your API URL and key and reconnect.",
+ # Each account's API host is a customer-specific subdomain (e.g. https://acme.api-us1.com),
+ # so match on the stable error prefix rather than a fixed host.
+ "402 Client Error: Payment Required": "Your ActiveCampaign account doesn't have an active plan, or its payment failed. Check your ActiveCampaign billing, then resync.",
# `active_campaign_source` raises this when the configured api_url fails our URL
# validation — an unresolvable host (wrong account name), a private/internal host,
# or a bad scheme. All are user-config problems retrying can't fix. Match the stable
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/active_campaign/tests/test_active_campaign_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/active_campaign/tests/test_active_campaign_source.py
index d261ef0eb260..5462e6634dff 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/active_campaign/tests/test_active_campaign_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/active_campaign/tests/test_active_campaign_source.py
@@ -75,7 +75,13 @@ class TestActiveCampaignSource:
@pytest.mark.parametrize(
"expected_key",
- ["401 Client Error", "403 Client Error", "Unauthorized for url", "ActiveCampaign API URL is not allowed"],
+ [
+ "401 Client Error",
+ "403 Client Error",
+ "Unauthorized for url",
+ "ActiveCampaign API URL is not allowed",
+ "402 Client Error: Payment Required",
+ ],
)
def test_non_retryable_errors(self, expected_key: str) -> None:
assert expected_key in self.source.get_non_retryable_errors()