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): stop retrying Convex document deltas cursor conflicts (#99327)

Tom Owers07ccbe8d297d
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/source.py
index 825aeb922bcf..c3c6f371e9d2 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/source.py
@@ -127,6 +127,16 @@ You can find your deployment URL and deploy key in your [Convex Dashboard](https
"turn off syncing for this table, then re-enable the sync."
),
"StreamingExportNotEnabled": "Streaming export requires the Convex Professional plan. See https://www.convex.dev/plans to upgrade.",
+ # Convex treats a document_deltas/list_snapshot cursor conflict as deterministic, not
+ # transient (it's one of the few codes their own backend classifies as a user error
+ # rather than retryable). It surfaces when a data import or backup restore on the
+ # deployment invalidates the cursor's position in the document log, so every retry
+ # replays the same request against the same now-invalid cursor.
+ "409 Client Error": (
+ "PostHog's sync position for this table no longer matches your Convex deployment. "
+ "This can happen after a data import or backup restore. Trigger a full resync of "
+ "this source to continue syncing."
+ ),
# Match a stable substring of the raised message, not the `InvalidWindowError` class name:
# the non-retryable check compares against `str(exception)`, which contains the message
# but not the class name. The table name in the message is volatile, so it's excluded.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py
index 2a8c3f4ffcd8..2d726c293d68 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py
@@ -564,6 +564,11 @@ class TestConvexNonRetryableErrors:
"404 Client Error: Not Found for url: "
"https://x.convex.cloud/api/list_snapshot?tableName=verification&format=json&component=betterAuth",
),
+ (
+ "cursor_conflict_409",
+ "409 Client Error: Conflict for url: "
+ "https://x.convex.cloud/api/document_deltas?tableName=users&cursor=123&format=json",
+ ),
(
"invalid_window",
"Delta cursor for table 'events' is older than Convex's ~30 day retention window. "
@@ -627,6 +632,7 @@ class TestConvexRetryableErrors:
[
("401", "401 Client Error: Unauthorized for url: https://x.convex.cloud/api/document_deltas"),
("403", "403 Client Error: Forbidden for url: https://x.convex.cloud/api/document_deltas"),
+ ("409", "409 Client Error: Conflict for url: https://x.convex.cloud/api/document_deltas"),
(
"invalid_window",
"Delta cursor for table 'events' is older than Convex's ~30 day retention window. "