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(twitter): treat X payment-required errors as non-retryable (#119823)

Tom Owers519484930c9a
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/twitter/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/twitter/source.py
index 40944ba2ea19..ee3def948085 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/twitter/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/twitter/source.py
@@ -59,6 +59,9 @@ class TwitterSource(ResumableSource[TwitterSourceConfig, TwitterResumeConfig]):
return {
"401 Client Error: Unauthorized for url: https://api.x.com": "X rejected the bearer token. Generate a new one in the X developer portal and reconnect the source.",
"403 Client Error: Forbidden for url: https://api.x.com": "Your X app cannot read this endpoint. Check the project's API access and credit balance in the X developer portal, or stop syncing this table.",
+ # X's pay-per-use plan answers 402 once the project's prepaid credits run out, mirroring
+ # the check in `validate_credentials` — retrying a sync won't refill the balance.
+ "402 Client Error: Payment Required for url: https://api.x.com": "Your X developer project has run out of API credits. Add credits in the X developer portal, then try again.",
}
def get_canonical_descriptions(self) -> CanonicalDescriptions: