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(langfuse): treat 404 responses as non-retryable (#72869)

Tom Owers751900962904
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/langfuse/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/langfuse/source.py
index 85e423aa90de..1d375b310fb8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/langfuse/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/langfuse/source.py
@@ -103,6 +103,10 @@ Find your project API keys in your Langfuse **Project settings > API Keys**. Set
return {
"401 Client Error": "Invalid Langfuse API keys. Check the project public key and secret key, and make sure the host matches your Langfuse data region.",
"403 Client Error": "Your Langfuse API keys do not have access to this resource. Check the keys and try again.",
+ # Every LANGFUSE_ENDPOINTS path is a collection route (no resource id in the URL), so a
+ # 404 here means the route itself doesn't exist on this host - typically a self-hosted
+ # instance running a Langfuse version that predates this endpoint. Retrying never helps.
+ "404 Client Error": "This Langfuse endpoint was not found on your host. Self-hosted instances on an older Langfuse version may not support it yet - upgrade your instance or remove this table from the sync.",
HOST_NOT_ALLOWED_ERROR: "The Langfuse host is not allowed. Please use a publicly reachable instance URL.",
HTTP_NOT_ALLOWED_ERROR: "The Langfuse host must use HTTPS. Please update the host to use https://.",
RESPONSE_LIMIT_ERROR: "The Langfuse host returned a response that was too large or too slow to download. Check that the host points at a real Langfuse instance.",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/langfuse/tests/test_langfuse_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/langfuse/tests/test_langfuse_source.py
index 05b22c4bc8d5..8f6991e40ee2 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/langfuse/tests/test_langfuse_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/langfuse/tests/test_langfuse_source.py
@@ -53,7 +53,9 @@ class TestLangfuseSource:
assert secret_key_field.secret is True
assert secret_key_field.required is True
- @pytest.mark.parametrize("expected_key", ["401 Client Error", "403 Client Error", RESPONSE_LIMIT_ERROR])
+ @pytest.mark.parametrize(
+ "expected_key", ["401 Client Error", "403 Client Error", "404 Client Error", RESPONSE_LIMIT_ERROR]
+ )
def test_non_retryable_errors(self, expected_key):
assert expected_key in self.source.get_non_retryable_errors()