{"record":{"id":"8db5c99b83a35de6","repo":"mastra-ai/mastra","slug":"mastra-livekit-turndetection-kind-requires","errorCode":null,"errorMessage":"@mastra/livekit: turnDetection '${kind}' requires '@livekit/agents-plugin-livekit'. Install it or use a built-in mode like 'vad' or 'stt'.","messagePattern":"@mastra/livekit: turnDetection '(.+?)' requires '@livekit/agents-plugin-livekit'\\. Install it or use a built-in mode like 'vad' or 'stt'\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"integrations/livekit/src/worker.ts","lineNumber":229,"sourceCode":"  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    );\n  }\n  return kind === 'english'\n    ? (new plugin.turnDetector.EnglishModel() as TurnDetectionSetting)\n    : (new plugin.turnDetector.MultilingualModel() as TurnDetectionSetting);\n}\n\nasync function resolveMastraAgent(\n  options: CreateLiveKitWorkerOptions,\n  args: ResolveMastraAgentArgs,\n): Promise<MastraAgent> {\n  let ref: string | MastraAgent | undefined =\n    typeof options.agent === 'function' ? await options.agent(args) : options.agent;\n  ref ??= args.metadata.agentId;\n  if (!ref) {","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/integrations/livekit/src/worker.ts#L211-L247","documentation":"createLiveKitWorker's semantic turn detection modes ('multilingual' or 'english') require the '@livekit/agents-plugin-livekit' turn detector package, loaded via dynamic import. When the import fails, the worker throws and suggests installing the plugin or falling back to a built-in mode like 'vad' or 'stt'.","triggerScenarios":"Setting turnDetection to 'multilingual' or 'english' in createLiveKitWorker options while @livekit/agents-plugin-livekit is not installed.","commonSituations":"Enabling semantic end-of-turn detection without adding the optional plugin dependency; pnpm strict installs omitting transitive deps; typo-free but unmet optional peer dependency after a dependency cleanup.","solutions":["Install @livekit/agents-plugin-livekit (pnpm add @livekit/agents-plugin-livekit).","Change turnDetection to a built-in mode: 'vad' or 'stt'.","Inspect the error's `cause` if the package is installed but the dynamic import still fails (bundler/resolution issues)."],"exampleFix":"// before\ncreateLiveKitWorker({ mastra, workflow: 'voiceFlow', turnDetection: 'english' }); // plugin missing\n// after\npnpm add @livekit/agents-plugin-livekit\ncreateLiveKitWorker({ mastra, workflow: 'voiceFlow', turnDetection: 'english' });\n// or\ncreateLiveKitWorker({ mastra, workflow: 'voiceFlow', turnDetection: 'vad' });","handlingStrategy":"fallback","validationCode":"let semanticTurnDetection = true;\ntry { await import('@livekit/agents-plugin-livekit'); } catch { semanticTurnDetection = false; }\nif (!semanticTurnDetection && ['english', 'multilingual'].includes(options.turnDetection)) {\n  console.warn('turn detector plugin missing; falling back to built-in mode');\n}","typeGuard":null,"tryCatchPattern":"let turnDetection = 'english';\ntry {\n  await import('@livekit/agents-plugin-livekit');\n} catch {\n  turnDetection = 'vad'; // built-in fallback\n}\ncreateLiveKitWorker({ mastra, workflow: 'voiceFlow', turnDetection });","preventionTips":["Install @livekit/agents-plugin-livekit whenever using 'english'/'multilingual' turnDetection.","Probe plugin availability at worker startup and log the effective turn detection mode.","Prefer built-in 'vad'/'stt' modes when you want zero extra dependencies."],"tags":["dependency","turn-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"}