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): tell users how to fix a refused meta ads connection (#123118)

Tom Owers2303cf391c21
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/meta_ads.py b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/meta_ads.py
index 9e00d63e95d6..1682caba384b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/meta_ads.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/meta_ads.py
@@ -481,7 +481,8 @@ META_REFUSED_CREATIVE_ERROR_SUBCODES = frozenset({2446211, 1443048})
META_BATCH_MAX_SUBREQUESTS = 50
META_AUTH_ERROR_MESSAGE = (
- "Meta Ads access token is invalid, expired, or lacks the required permissions. Please re-authorize the integration."
+ "Your Meta Ads connection has expired or is missing permissions. Reconnect with a Facebook account that can "
+ "access your ad accounts, and allow all permissions."
)
# Code 190 / subcode 459: Meta has checkpointed the user behind the token. The token stays refused
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 e1faf3c18a97..c0333a097939 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
@@ -404,9 +404,7 @@ class MetaAdsSource(ResumableSource[MetaAdsSourceConfig, MetaAdsResumeConfig], O
try:
accounts = list_ad_accounts(integration)
except MetaAdsAuthError as e:
- raise IntegrationAccountListingError(
- f"{META_AUTH_ERROR_MESSAGE} Make sure the connected account can access your ad accounts."
- ) from e
+ raise IntegrationAccountListingError(META_AUTH_ERROR_MESSAGE) from e
except MetaAdsRateLimitError as e:
# Throttling is not a bug: surface it as an actionable 400 the user can retry, rather
# than a 500 that pages us.
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 2803f294d775..9c35f2d76b81 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
@@ -1513,7 +1513,7 @@ class TestMidChunkLimitFallback:
self.URL, self.PARAMS, {"since": "2026-04-21", "until": "2026-04-21"}, None, manager
)
assert next(gen) == [{"ad_id": "1"}]
- with pytest.raises(Exception, match="Please re-authorize the integration"):
+ with pytest.raises(Exception, match="Reconnect with a Facebook account"):
list(gen)
# Initial + failed cursor only — the limit ladder is not exercised for auth errors.