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(pipedrive): stop retrying when a Pipedrive plan lacks the Projects feature (#130434)

Tom Owers439e1c7c5083
diff --git a/products/warehouse_sources/sources/pipedrive/source.py b/products/warehouse_sources/sources/pipedrive/source.py
index 9cd21389f744..b64221594993 100644
--- a/products/warehouse_sources/sources/pipedrive/source.py
+++ b/products/warehouse_sources/sources/pipedrive/source.py
@@ -166,6 +166,9 @@ Deletions in Pipedrive are not applied to tables synced by webhook. Switch a tab
return {
"401 Client Error": "Invalid Pipedrive API token. Please check your token and reconnect.",
"403 Client Error": "Your Pipedrive user lacks permission for this data. Please check your access and reconnect.",
+ # Pipedrive returns 402 when a feature (e.g. Projects) isn't included in the account's
+ # plan. No retry fixes a plan limitation, so stop and point at the Pipedrive side.
+ "402 Client Error": "Your Pipedrive plan doesn't include this feature. Upgrade your Pipedrive plan, or disable the affected tables, then try again.",
}
def get_canonical_descriptions(self) -> CanonicalDescriptions:
diff --git a/products/warehouse_sources/sources/pipedrive/tests/test_pipedrive_source.py b/products/warehouse_sources/sources/pipedrive/tests/test_pipedrive_source.py
index 44f019971505..5c086b465f98 100644
--- a/products/warehouse_sources/sources/pipedrive/tests/test_pipedrive_source.py
+++ b/products/warehouse_sources/sources/pipedrive/tests/test_pipedrive_source.py
@@ -7,6 +7,7 @@ from products.warehouse_sources.sources.pipedrive._config import PipedriveSource
from products.warehouse_sources.sources.pipedrive.settings import ENDPOINTS
from products.warehouse_sources.sources.pipedrive.source import PipedriveSource
from products.warehouse_sources.sources.sdk import SourceFieldInputConfig, WebhookSourceManager
+from products.warehouse_sources.sources.sdk.testing import ScriptedResponse, SourceDriver, error_message_matches
class TestPipedriveSource:
@@ -188,3 +189,11 @@ class TestPipedriveSource:
self.source.source_for_pipeline(self.config, mock.MagicMock(), inputs)
assert isinstance(mock_pipedrive_source.call_args.kwargs["webhook_source_manager"], WebhookSourceManager)
+
+ def test_plan_restricted_response_is_classified_non_retryable(self) -> None:
+ # project_boards is a plain lookup endpoint (no fan-out/custom read), so one scripted
+ # answer drives the real request-and-raise path the pipeline actually runs.
+ result = SourceDriver(self.source, self.config).run("project_boards", [ScriptedResponse(status=402)])
+
+ assert result.raised is not None
+ assert error_message_matches(str(result.raised), self.source.get_non_retryable_errors())