Report why a voice interview failed to start - #24
Open
Alimaster30 wants to merge 1 commit into
Open
Conversation
"Check your network and microphone" was shown for every start failure, including ones no retry can fix: a rejected public key, an origin that is not on the Vapi allowlist, a missing assistant id, and an exhausted quota. Vapi already reports the stage that failed and the underlying error, so classify them and say which are configuration problems. Two ordering bugs meant the specific reason was lost anyway. Vapi emits "call-start-failed" and then returns null from start(), so the generic branch overwrote the message the event handler had just set; it now only fills in when nothing has explained the failure. The payload is also logged, since the stage is the only way to tell a service problem from a connection problem after the fact. start() returns null without attempting anything when the SDK still considers a call started, which stranded retries on the original error. Stop any existing session before starting a new one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every start failure showed the same message:
That is wrong for most of the causes. A rejected public key, an origin missing from the Vapi allowlist, a bad assistant id, and an exhausted quota all produce it — and none of them can be fixed by checking your network or retrying. Someone hitting this is sent to restart their router while the actual problem is a config value.
What changed
lib/callFailure.tsclassifies thecall-start-failedpayload — Vapi already reports the failed stage and the underlying error — and returns a message that says whether it is a configuration problem, a quota problem, a microphone problem, or genuinely unknown.Two ordering bugs were discarding the reason anyway:
call-start-failedand then returnsnullfromstart(). Theif (!call)branch overwrote the specific message the event handler had just set. It now only fills in when nothing has explained the failure.start()returnsnullwithout attempting anything when the SDK still considers a call started, which stranded retries on the original error. Any existing session is now stopped first.The raw payload is also logged, because the stage is the only way to tell a service problem from a connection problem after the fact.
Testing
Six new tests in
tests/call-failure.test.mjscover each classification and the fallback. Full suite 26 pass.tsc,eslintclean.Not verified against a live failure — this exists to make the next one diagnosable.