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(tasks): identify sandbox startup errors (#95057)

Jonathan Mielooe01111b45872
diff --git a/products/tasks/backend/presentation/views/api.py b/products/tasks/backend/presentation/views/api.py
index 14c50542b340..6d6da89798f9 100644
--- a/products/tasks/backend/presentation/views/api.py
+++ b/products/tasks/backend/presentation/views/api.py
@@ -2872,7 +2872,13 @@ class TaskRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
if not connection.sandbox_url:
return Response(
- TaskRunErrorResponseSerializer({"error": "No active sandbox for this task run"}).data,
+ TaskRunErrorResponseSerializer(
+ {
+ "type": "runtime_unavailable",
+ "code": "sandbox_not_ready",
+ "error": "No active sandbox for this task run",
+ }
+ ).data,
status=status.HTTP_400_BAD_REQUEST,
)
diff --git a/products/tasks/backend/tests/test_api.py b/products/tasks/backend/tests/test_api.py
index 3cf367c65afe..7f91609882a4 100644
--- a/products/tasks/backend/tests/test_api.py
+++ b/products/tasks/backend/tests/test_api.py
@@ -11678,7 +11678,14 @@ class TestTaskRunCommandAPI(BaseTaskAPITest):
)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
- self.assertIn("No active sandbox", response.json()["error"])
+ self.assertEqual(
+ response.json(),
+ {
+ "type": "runtime_unavailable",
+ "code": "sandbox_not_ready",
+ "error": "No active sandbox for this task run",
+ },
+ )
@parameterized.expand(
[