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(vapi): mark the known-bad chat list 400 as non-retryable (#115857)

Tom Owers9b679c39e7a4
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vapi/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vapi/source.py
index af0578c20af8..369372fdd857 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vapi/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vapi/source.py
@@ -92,6 +92,10 @@ You can find your private API key in the [Vapi dashboard](https://dashboard.vapi
# spec-compliant request and gets the same 400 back. Match the path, not the
# per-request query string, so this stays scoped to this one known-bad endpoint.
"400 Client Error: Bad Request for url: https://api.vapi.ai/v2/phone-number": "Vapi rejected the request to list phone numbers on API v2 for this account. This looks like an issue on Vapi's side rather than your credentials — contact Vapi support, or disable the phone_numbers table if you don't need it.",
+ # Same pattern as the phone-number v2 case above, on the /chat list endpoint: the
+ # request (limit/page/sortOrder/sortBy/createdAtGt) matches Vapi's published spec,
+ # and every retry replays the identical request and gets the same 400 back.
+ "400 Client Error: Bad Request for url: https://api.vapi.ai/chat": "Vapi rejected the request to list chats for this account. This looks like an issue on Vapi's side rather than your credentials — contact Vapi support, or disable the chats table if you don't need it.",
}
def get_schemas(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vapi/tests/test_vapi_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vapi/tests/test_vapi_source.py
index 15db2881fb48..7dfee8e5c85c 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vapi/tests/test_vapi_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vapi/tests/test_vapi_source.py
@@ -26,6 +26,7 @@ class TestVapiSource:
"401 Client Error: Unauthorized for url: https://api.vapi.ai/call?limit=100",
"403 Client Error: Forbidden for url: https://api.vapi.ai/assistant?limit=100",
"400 Client Error: Bad Request for url: https://api.vapi.ai/v2/phone-number?limit=100&page=1&sortOrder=ASC&sortBy=createdAt",
+ "400 Client Error: Bad Request for url: https://api.vapi.ai/chat?createdAtGt=2026-09-11T12%3A24%3A53.890Z&limit=100&page=1&sortOrder=ASC&sortBy=createdAt",
]
)
def test_non_retryable_errors_match_auth_failures(self, observed_error):
@@ -38,7 +39,7 @@ class TestVapiSource:
"500 Server Error: Internal Server Error for url: https://api.vapi.ai/call",
"HTTPSConnectionPool(host='api.vapi.ai', port=443): Read timed out.",
# A 400 on a different endpoint must stay retryable — only the known-bad v2
- # phone-number path is non-retryable, not every 400 from api.vapi.ai.
+ # phone-number and chat paths are non-retryable, not every 400 from api.vapi.ai.
"400 Client Error: Bad Request for url: https://api.vapi.ai/call?limit=100",
]
)