Issue: Error Responses Not Reaching AI Agent in Va...
# support
r
I'm experiencing an issue where error responses (non-200 status codes) from my webhook aren't properly reaching the AI agent. ## The Issue - When the webhook returns a 200 status code, everything works fine - When the webhook returns a 400/500 status code with an error message in the response body, the AI agent doesn't seem to receive the error message - In the logs, I can see the error response being sent correctly, but the AI doesn't acknowledge it ## What I've Tried - I've formatted error messages with an "ERROR:" prefix to make them more visible - I've confirmed the error responses are properly formatted according to the Vapi API docs - I've verified the responses are being sent with the correct Content-Type header ## Example Response (400 Bad Request) ```json { "results": [ { "toolCallId": "call_abc123", "result": "ERROR: Missing required parameters: Email. Please provide all required information to find available appointment times." } ] }
v
Hey! To help track down this issue, could you share: - The call ID - When exactly this happened (the timestamp) - What response you expected to get - What response you actually got instead This would really help us figure out what went wrong!
r
Thanks for looking into this! Here are the details you requested: **Call ID**:
call_4jRGUjRFivxyf75J3Uu2eoBh
**Timestamp**: 2025-05-21 17:37:39.342 (Started At) - 2025-05-21 17:37:41.772 (Finished At) **Expected Response**: The AI agent should have received the error message I sent back:
Copy code
json
{
  "results": [
    {
      "toolCallId": "call_4jRGUjRFivxyf75J3Uu2eoBh",
      "result": "ERROR: Missing required parameters: Email. Please provide all required information to find available appointment times."
    }
  ]
}
**Actual Response**: The AI agent received an empty response and didn't acknowledge the error at all. In my webhook logs, I can see that I correctly sent the 400 status code with the error message above, but the AI continued as if nothing happened. The issue seems to be that when I return non-200 status codes, the error response body isn't being forwarded to the AI agent properly.
v
Apologize for the confusion but that is the toolCallid and we need the id for the whole call. You can find the call id here in the dashboard for a specific call. https://cdn.discordapp.com/attachments/1374830137845092455/1375268647613890611/call_id.png?ex=6831123c&is=682fc0bc&hm=563c024efabc203b2188e7f9a1dfa262397ed4bdf886c8ebe169c7d9ba5c180c&
r
- __Tool Call ID__:
call_4jRGUjRFivxyf75J3Uu2eoBh
- __Vapi Call ID__:
77c764ef-deb5-481b-a8b0-646a1fc2a730
This is the call where the AI was missing the
Email
parameter despite
strict: true
validation, and where the error response wasn't reaching the AI.
v
To ensure your error messages reach the AI agent in Vapi, always return a
200
status code from your webhook—even for errors.
Place your error details in the response body, like this:
Copy code
json
{
  "results": [
    {
      "toolCallId": "call_abc123",
      "result": "ERROR: Missing required parameters: Email. Please provide all required information to find available appointment times."
    }
  ]
}
Non-200 status codes will cause Vapi to ignore the response body and not forward the error to the agent. Sources: - [Vapi Server Authentication Documentation](https://docs.vapi.ai/server-url/server-authentication) - [Vapi Webhooks Server Message API Reference](https://docs.vapi.ai/api-reference/webhooks/server-message)
v
Message marked as helpful by @rpv! 🎉
v
Hey @rpv, checking if this is resolved/solved for you?
r
Yes, thank you!
v
I'm glad to hear your issue is resolved! Returning a 200 status code from your webhook and including error details in the response body is the right approach for ensuring the AI agent receives error messages in Vapi. If you have any more questions in the future, feel free to ask.
v
Message marked as helpful by @rpv! 🎉
v
Glad the issue was resolved. Please reach out to us if you have any other questions regarding this issue