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(data-imports): stop retrying Microsoft Clarity 400 responses (#83826)

Tom Owers1e99c485fe3d
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/microsoft_clarity/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/microsoft_clarity/source.py
index 20327c489e18..9a0018fd0ac1 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/microsoft_clarity/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/microsoft_clarity/source.py
@@ -57,6 +57,7 @@ class MicrosoftClaritySource(SimpleSource[MicrosoftClaritySourceConfig]):
def get_non_retryable_errors(self) -> dict[str, str | None]:
return {
+ "400 Client Error": "Microsoft Clarity rejected the request. Check the reporting window and breakdown dimensions on this source and reconnect.",
"401 Client Error": "Your Microsoft Clarity API token is invalid or expired. Generate a new token in Clarity under Settings -> Data Export and reconnect.",
"403 Client Error": "This Microsoft Clarity API token is not authorized for this project.",
"429 Client Error": "The Microsoft Clarity daily quota (10 requests per project) has been used up. Try again after the quota resets.",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/microsoft_clarity/tests/test_microsoft_clarity_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/microsoft_clarity/tests/test_microsoft_clarity_source.py
index 183a2cf0d04d..b11b8b488a97 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/microsoft_clarity/tests/test_microsoft_clarity_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/microsoft_clarity/tests/test_microsoft_clarity_source.py
@@ -132,6 +132,10 @@ class TestValidateCredentials:
class TestNonRetryableErrors:
@parameterized.expand(
[
+ (
+ "bad_request",
+ "400 Client Error: Bad Request for url: https://www.clarity.ms/export-data/api/v1/project-live-insights?numOfDays=3",
+ ),
(
"unauthorized",
"401 Client Error: Unauthorized for url: https://www.clarity.ms/export-data/api/v1/project-live-insights",