: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(mistral_ai): stop retrying when fine-tuning jobs access is gone (#80226)
Tom Owers565df17ec5a2
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mistral_ai/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mistral_ai/source.pyindex ed7782c8fc9b..c7fcf5d0fd24 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mistral_ai/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mistral_ai/source.py@@ -86,6 +86,10 @@ You can create an API key in [La Plateforme](https://console.mistral.ai/api-keys# stable status text and base host, not the per-request path/query."401 Client Error: Unauthorized for url: https://api.mistral.ai": "Your Mistral AI API key is invalid or has been revoked. Create a new key in La Plateforme, then reconnect.","403 Client Error: Forbidden for url: https://api.mistral.ai": "Your Mistral AI API key is missing the permissions needed to sync this data. Check the key's permissions in La Plateforme, then reconnect.",+ # Mistral returns 410 (permanently gone, not a transient 404/5xx) when fine-tuning is not+ # available for the workspace — retrying can never make a gone resource reappear. Match the+ # base path, not the page/page_size query, so it catches the error on every page.+ "410 Client Error: Gone for url: https://api.mistral.ai/v1/fine_tuning/jobs": "Fine-tuning is not available for your Mistral AI workspace, so the Fine tuning jobs table can't sync. Disable that table, or check your workspace's fine-tuning access in La Plateforme.",}def get_schemas(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mistral_ai/tests/test_mistral_ai_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mistral_ai/tests/test_mistral_ai_source.pyindex ab61e53f022b..5c7197eb9563 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mistral_ai/tests/test_mistral_ai_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mistral_ai/tests/test_mistral_ai_source.py@@ -106,6 +106,23 @@ class TestNonRetryableErrors:def test_credential_errors_are_non_retryable(self, _name: str, observed: str) -> None:assert any(key in observed for key in MistralAISource().get_non_retryable_errors())+ @parameterized.expand(+ [+ (+ "page_zero",+ "410 Client Error: Gone for url: https://api.mistral.ai/v1/fine_tuning/jobs?page=0&page_size=100",+ ),+ (+ "later_page",+ "410 Client Error: Gone for url: https://api.mistral.ai/v1/fine_tuning/jobs?page=3&page_size=100",+ ),+ ]+ )+ def test_fine_tuning_gone_is_non_retryable(self, _name: str, observed: str) -> None:+ # Mistral's 410 means fine-tuning is unavailable for the workspace, not a page-specific fluke,+ # so the match must hold regardless of which page the pagination loop was on.+ assert any(key in observed for key in MistralAISource().get_non_retryable_errors())+@parameterized.expand([("rate_limited", "429 Client Error: Too Many Requests for url: https://api.mistral.ai/v1/files"),