: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(data-warehouse): give actionable copy for Meta Ads permission errors (#68230)
Tom Owersc8a78544beb1
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.pyindex 2dda46cb7046..f16d1855612c 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@@ -69,8 +69,23 @@ class MetaAdsSource(ResumableSource[MetaAdsSourceConfig, MetaAdsResumeConfig]):# access tokens, checkpoint-required, invalidated sessions, permission denials).# `meta_ads._raise_meta_api_error` prefixes these with this exact message.META_AUTH_ERROR_MESSAGE: META_AUTH_ERROR_MESSAGE,- "Ad account owner has NOT": None,- "cannot be loaded due to missing permissions": None,+ # Graph API code 200: "Ad account owner has NOT granted ads_management or ads_read+ # permission." The connected Meta user can't read this ad account's data. Retrying+ # can't grant the permission — the account owner has to. Without a message here the+ # raw Graph API JSON blob surfaces to the user, so give actionable guidance instead.+ "Ad account owner has NOT": (+ "Meta denied access to this ad account — the connected Meta account is missing the "+ "ads_read permission needed to sync its data. Ask the ad account owner to grant that "+ "access, then reconnect the Meta Ads integration."+ ),+ # Graph API code 100: "This endpoint cannot be loaded due to missing permissions." A+ # specific endpoint can't be read with the permissions the user granted. Same as above:+ # not fixable by retrying, and the raw JSON would otherwise reach the user.+ "cannot be loaded due to missing permissions": (+ "Meta blocked this request because the connected account is missing a permission "+ "required to read your ads data. Please reconnect the Meta Ads integration and grant "+ "all requested permissions."+ ),# Meta returns this 500 when the requested query is too large for their backend to# service. Both pagination paths adapt to it (stats chunks shrink 30 → 7 → 1 day, and# both paths shrink the per-page limit 500 → 100 → 50); if it still escapes after those