: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(data-warehouse): surface friendly schema-discovery errors during onboarding (#67424)
Tom Owersd50d7ce5d291
diff --git a/products/data_warehouse/backend/presentation/views/external_data_source.py b/products/data_warehouse/backend/presentation/views/external_data_source.pyindex 086fe047f0a7..df7f1588e55c 100644--- a/products/data_warehouse/backend/presentation/views/external_data_source.py+++ b/products/data_warehouse/backend/presentation/views/external_data_source.py@@ -2661,12 +2661,12 @@ class ExternalDataSourceViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixitry:schemas = source.get_schemas(source_config, self.team_id)except Exception as e:- _, is_expected_source_error = _classify_refresh_schemas_error(source, e)+ error_message, is_expected_source_error = _classify_refresh_schemas_error(source, e)if not is_expected_source_error:capture_exception(e, {"source_type": source_type, "team_id": self.team_id})return Response(status=status.HTTP_400_BAD_REQUEST,- data={"message": str(e)},+ data={"message": error_message},)# Best-effort per-endpoint scope probe — transient failure falls back to "available".diff --git a/products/data_warehouse/backend/tests/api/test_external_data_source.py b/products/data_warehouse/backend/tests/api/test_external_data_source.pyindex 69cb05b68603..66dfa72a2207 100644--- a/products/data_warehouse/backend/tests/api/test_external_data_source.py+++ b/products/data_warehouse/backend/tests/api/test_external_data_source.py@@ -4052,10 +4052,13 @@ class TestExternalDataSource(APIBaseTest):)assert response.status_code == 400- assert response.json()["message"] == str(error)if expect_capture:+ # Unexpected errors return the safe generic fallback, never the raw exception string.+ assert response.json()["message"] == "Could not fetch schemas from source."mock_capture_exception.assert_called_once_with(error, {"source_type": "BigQuery", "team_id": self.team.pk})else:+ # Expected per-source errors surface the classifier's friendly copy.+ assert response.json()["message"] == str(error)mock_capture_exception.assert_not_called()def test_database_schema_stripe_surfaces_per_endpoint_permission_errors(self):