WayloAIWaylo Docs
Web SDK

Errors and troubleshooting

Every error code, what to tell the visitor, and what to fix.

import { WayloVoiceError } from '@waylovoice/client';

try {
  await wayloVoice.start({ agentId });
} catch (error) {
  if (error instanceof WayloVoiceError && error.code === 'MICROPHONE_DENIED') showMicHelp();
}

Symptoms

  • Nothing happens on click: the constructor threw a RangeError, or start() rejected with one. Check the browser console. A common cause is a sessionEndpoint on another origin.
  • No microphone prompt: the page is not on HTTPS or localhost.
  • I can't hear the agent: state.playback is blocked (see blocked audio), or check the system volume and the chosen speaker.
  • Connects, then drops: a firewall or VPN may block WebRTC (UDP). Try another network.
  • "Call failed" with a code: see the table below. For CONNECTION_FAILED, read your server log first.

The session endpoint must be on the page's own origin, so you don't need CORS. A cross-origin URL throws in the constructor.

How errors arrive

  • A failed start() rejects with a WayloVoiceError, and the last state has state.end with status: 'failed' and the same error. It does not also emit an error event.
  • Problems after start() resolved come as error events, and in state.end.error if they end the call.
  • stop() never rejects.

Decide on code, not on the message: codes stay fixed, messages may change.

Error codes

CodeWhat happenedWhat to tell the visitorTry again?
AUTH_REQUIREDThe session endpoint answered 401 or redirected."Please sign in to talk."After signing in
ACCESS_DENIEDThe session endpoint answered 403."You can't use this agent."No
LIMIT_REACHEDThe session endpoint answered 429."Too many calls right now. Try again in a minute."Yes, later
INVALID_SESSIONThe session endpoint's 200 body is not a Waylo session; return it unchanged."Something went wrong. Please try again later."No, fix the endpoint
SESSION_EXPIREDThe session expired or was rejected."Please try again."Yes, new call
CONNECTION_FAILEDThe endpoint failed or took over 15 s, the call could not connect, or the call server ended it with an error."Couldn't connect. Check your internet and try again."Yes
CONNECTION_LOSTThe visitor's connection dropped mid-call and the call could not continue: reconnecting failed, took over 45 s, or found no agent within 5 s of reconnecting."Your connection dropped. Check your internet and start a new call."Yes, new call
MICROPHONE_DENIEDThe visitor or the browser blocked the microphone."Allow the microphone in your browser, then try again."After allowing it
MICROPHONE_IN_USEAnother app or tab holds the microphone, or the system could not start it."Your microphone is busy. Close other apps using it, then try again."Yes
MICROPHONE_UNAVAILABLENo usable microphone, the chosen one can't be opened, or the browser refused it. The original error is in cause."No working microphone found. Connect one, then try again."Yes, after fixing it
SPEAKER_UNAVAILABLEThe chosen speaker can't be used or the browser can't choose one; the current speaker keeps playing.Nothing; hide or reset the speaker picker.Not needed
AGENT_TIMEOUTThe agent wasn't ready in time."The agent isn't available right now. Try again."Yes
AGENT_LEFTThe agent left without ending the call."The call dropped. Start a new one."Yes, new call
AGENT_ERRORThe agent hit an error and ended the call; state.end.reason says why."Something went wrong. Try again."Yes, new call
TRANSCRIPT_FAILEDOne caption line couldn't be read; the call goes on.Nothing.Not needed
ALREADY_STARTEDstart() was called twice on one instance; a code bug.Nothing; create a new WayloVoice per call.Not needed
CANCELLEDstop() was called while starting.Nothing.Not needed

Waylo API errors

What your session endpoint can get back from POST /sessions/web. Log the status and error.code on your server and answer 502; they are about your setup, not the visitor. The body is { "error": { "code", "message" } }.

StatusLikely cause
400A field is malformed, for example an id that isn't a UUID, or a bad Idempotency-Key.
401The API key is wrong or revoked.
403The key lacks sessions:write.
404Wrong workspace or agent id, a key made for another workspace, or the agent isn't published and active.
409A retry with the same Idempotency-Key hit a session that has ended or is about to time out, or that key was used for another agent. Use a new key.
429Too many requests. Pass it on as 429.
503Waylo can't start calls right now. Try again later.

Common mistakes

  • Putting the API key, or a call to the Waylo API, in browser code.
  • Reusing a WayloVoice for a second call (ALREADY_STARTED).
  • Calling start() after an await in the click handler. Audio may be blocked; handle playback: 'blocked'.
  • A session endpoint that changes the Waylo response.
  • Opening the page over plain http other than localhost: browsers then give no microphone.

On this page