Error occurs every time the system ends the call.
# support
p
I am having this error everytime the system ends the call: {action: 'error', errorMsg: 'Meeting has ended', error: {…}, callClientId: '17461752055960.374240114 If the call was ended by the user, there will be no error. But if it was ended by the system that error will occur. How do I solve it pleas?
v
To solve the "Meeting has ended" error when the system ends the call, try implementing proper error handling in your code:
Copy code
javascript
// When ending a call programmatically
function endCall(callId) {
  try {
    // Use the say method with endCallAfterSpoken parameter
    vapi.say({
      message: "Thank you for calling. Goodbye!",
      endCallAfterSpoken: true
    });
  } catch (error) {
    // Handle the "Meeting has ended" error gracefully
    if (error.message.includes("Meeting has ended")) {
      console.log("Call ended successfully, ignoring expected error");
    } else {
      console.error("Unexpected error:", error);
    }
  }
}
This approach gracefully handles the expected error message when the system ends the call. Sources: - [Discord discussion about handling errors in Vapi](https://discord.com/channels/1211482211119796234/1326262542858850445) - [Discord discussion about ending calls gracefully](https://discord.com/channels/1211482211119796234/1336004944150401166)
c
Hey! To help track down this issue, could you share: - The call ID This would really help us figure out what went wrong!