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(warehouse_sources): recognize blank-reason-phrase 400s from Zoho's OAuth endpoint (#77882)

Tom Owers3047f901edf4
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/zoho_crm/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/zoho_crm/source.py
index d3a80e5ece08..208d594034e7 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/zoho_crm/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/zoho_crm/source.py
@@ -54,6 +54,10 @@ class ZohoCRMSource(ResumableSource[ZohoCRMSourceConfig, ZohoCRMResumeConfig]):
return {
"Zoho CRM token refresh failed": REFRESH_TOKEN_REJECTED_MESSAGE,
"400 Client Error: Bad Request for url: https://accounts.zoho": "Zoho CRM rejected your OAuth credentials. Check that the client ID, client secret, and refresh token all belong to the same self client.",
+ # Some responses carry no reason phrase (e.g. over HTTP/2, which has none), so
+ # `requests.raise_for_status()` renders it blank instead of "Bad Request" — match that
+ # variant too, or the same credential rejection retries the whole activity budget.
+ "400 Client Error: for url: https://accounts.zoho": "Zoho CRM rejected your OAuth credentials. Check that the client ID, client secret, and refresh token all belong to the same self client.",
"401 Client Error: Unauthorized for url": "Your Zoho CRM access token is invalid or expired. Reconnect the source to issue a new one.",
"403 Client Error: Forbidden for url": "Your Zoho CRM token is missing a scope for this module. Re-authorize with the ZohoCRM.modules.ALL and ZohoCRM.settings.fields.READ scopes.",
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/zoho_crm/tests/test_zoho_crm_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/zoho_crm/tests/test_zoho_crm_source.py
index b55f8a2d86d9..758a423b0239 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/zoho_crm/tests/test_zoho_crm_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/zoho_crm/tests/test_zoho_crm_source.py
@@ -95,6 +95,8 @@ class TestZohoCRMSource:
[
"Zoho CRM token refresh failed: invalid_client",
"400 Client Error: Bad Request for url: https://accounts.zoho.eu/oauth/v2/token",
+ # Blank reason phrase variant (e.g. an HTTP/2 response, which has none).
+ "400 Client Error: for url: https://accounts.zoho.eu/oauth/v2/token",
"401 Client Error: Unauthorized for url: https://www.zohoapis.com/crm/v8/Leads",
"403 Client Error: Forbidden for url: https://www.zohoapis.com/crm/v8/Deals",
],