{"record":{"id":"d5b70823f09c6b62","repo":"mastra-ai/mastra","slug":"mastra-livekit-voice-activity-detection-requires","errorCode":null,"errorMessage":"@mastra/livekit: voice activity detection requires '@livekit/agents-plugin-silero'. Install it, pass your own `vad` instance, or set `vad: false`.","messagePattern":"@mastra/livekit: voice activity detection requires '@livekit/agents-plugin-silero'\\. Install it, pass your own `vad` instance, or set `vad: false`\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"integrations/livekit/src/worker.ts","lineNumber":215,"sourceCode":"  /**\n   * Voice-pipeline observability. When the Mastra instance has observability configured, each\n   * session opens a `voice call` trace: LiveKit's STT, TTS, end-of-utterance, VAD, and LLM\n   * latency metrics become child spans, and every turn's Mastra agent run nests under the call,\n   * which closes with a token/audio usage roll-up. Defaults to `true`; pass `false` to disable.\n   */\n  observability?: boolean;\n  inputOptions?: Parameters<voice.AgentSession['start']>[0]['inputOptions'];\n  outputOptions?: Parameters<voice.AgentSession['start']>[0]['outputOptions'];\n  /** Called after the session starts — attach event listeners, trigger replies, etc. */\n  onSessionStart?: (args: SessionStartArgs) => void | Promise<void>;\n}\n\nasync function loadSileroVad(): Promise<VAD> {\n  let silero;\n  try {\n    silero = await import('@livekit/agents-plugin-silero');\n  } catch (error) {\n    throw new Error(\n      \"@mastra/livekit: voice activity detection requires '@livekit/agents-plugin-silero'. \" +\n        'Install it, pass your own `vad` instance, or set `vad: false`.',\n      { cause: error },\n    );\n  }\n  return silero.VAD.load();\n}\n\nasync function loadTurnDetector(kind: 'multilingual' | 'english'): Promise<TurnDetectionSetting> {\n  let plugin;\n  try {\n    plugin = await import('@livekit/agents-plugin-livekit');\n  } catch (error) {\n    throw new Error(\n      `@mastra/livekit: turnDetection '${kind}' requires '@livekit/agents-plugin-livekit'. ` +\n        \"Install it or use a built-in mode like 'vad' or 'stt'.\",\n      { cause: error },\n    );","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/integrations/livekit/src/worker.ts#L197-L233","documentation":"createLiveKitWorker uses the Silero VAD plugin for voice activity detection by default, loading '@livekit/agents-plugin-silero' via dynamic import. When that import fails (package not installed), it throws with the original import error attached as `cause`, and suggests installing it, supplying your own `vad`, or disabling VAD.","triggerScenarios":"Calling createLiveKitWorker with vad enabled/default while @livekit/agents-plugin-silero is not installed in the project.","commonSituations":"Fresh checkout without the optional peer dependency installed; pnpm strict node_modules hiding transitive deps; VAD left on default after trimming dependencies; bundlers failing to resolve the optional dynamic import.","solutions":["Install @livekit/agents-plugin-silero (pnpm add @livekit/agents-plugin-silero).","Pass your own VAD instance via the `vad` option to createLiveKitWorker.","Explicitly set `vad: false` in createLiveKitWorker options to disable voice activity detection.","Check the error's `cause` for the underlying import failure if the package is installed (e.g. bundler resolution issues)."],"exampleFix":"// before\ncreateLiveKitWorker({ mastra, workflow: 'voiceFlow' }); // silero not installed\n// after\npnpm add @livekit/agents-plugin-silero\ncreateLiveKitWorker({ mastra, workflow: 'voiceFlow' });\n// or\ncreateLiveKitWorker({ mastra, workflow: 'voiceFlow', vad: false });","handlingStrategy":"fallback","validationCode":"let sileroAvailable = true;\ntry { await import('@livekit/agents-plugin-silero'); } catch { sileroAvailable = false; }\nif (!sileroAvailable && options.vad !== false && !options.vad) {\n  console.warn('silero plugin missing; set vad:false or install @livekit/agents-plugin-silero');\n}","typeGuard":null,"tryCatchPattern":"let workerOptions = { mastra, workflow: 'voiceFlow' };\ntry {\n  await import('@livekit/agents-plugin-silero');\n} catch {\n  workerOptions = { ...workerOptions, vad: false }; // graceful fallback\n}\ncreateLiveKitWorker(workerOptions);","preventionTips":["Add @livekit/agents-plugin-silero as a direct dependency of the worker package.","Configure bundlers to resolve optional dynamic imports used by LiveKit plugins.","Decide explicitly between installing silero, providing a custom vad, or vad:false — never rely on the default silently."],"tags":["dependency","voice-activity-detection","livekit","missing-package"],"backgroundTag":"missing-peer-dependency","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}