{"record":{"id":"18b034b28cac2312","repo":"moeru-ai/airi","slug":"1-microphone-permission-not-granted-browser-sho","errorCode":null,"errorMessage":"1. Microphone permission not granted - browser should prompt automatically","messagePattern":"1\\. Microphone permission not granted - browser should prompt automatically","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/stage-ui/src/libs/providers/providers/browser-web-speech-api/provider.ts","lineNumber":458,"sourceCode":"\n  recognition.onsoundend = () => {\n    console.info('Web Speech API sound ended')\n  }\n\n  recognition.onaudioend = () => {\n    console.info('Web Speech API audio capture ended')\n  }\n\n  recognition.onnomatch = () => {\n    console.info('Web Speech API: No speech match')\n  }\n\n  const started = startRecognition()\n  if (!started) {\n    // If immediate start failed, it might be a permission issue\n    // Web Speech API will prompt for permission automatically, so we just log\n    console.warn('Web Speech API recognition did not start immediately. This might be due to:')\n    console.warn('1. Microphone permission not granted - browser should prompt automatically')\n    console.warn('2. Recognition already running - this is normal if called multiple times')\n    console.warn('3. Browser requires user gesture - ensure microphone was enabled by user action')\n\n    // Don't retry immediately - wait for permission or user action\n    // The recognition instance is already created, so it can be started later if needed\n  }\n\n  return {\n    fullStream,\n    text: deferredText.promise,\n    textStream,\n    recognition: recognitionInstance,\n  }\n}\n","sourceCodeStart":440,"sourceCodeEnd":473,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/stage-ui/src/libs/providers/providers/browser-web-speech-api/provider.ts#L440-L473","documentation":"Second line of the Web Speech API start-failure warn block: enumerated cause 1, 'Microphone permission not granted'. Emitted when startRecognition() returned false and the most likely reason is that microphone permission is still in the 'prompt' or 'denied' state. The provider logs and waits - the browser is expected to surface the permission prompt automatically rather than the code retrying.","triggerScenarios":"First use of the browser-web-speech-api provider on an origin where microphone permission was never granted; permission revoked between sessions; embedded browsers or shells (Electron/Tauri) where no automatic prompt appears so start() keeps failing.","commonSituations":"Fresh install before onboarding's permission step; user blocked the mic then re-enables the hearing feature; iframe without allow='microphone'; kiosk-style embedders.","solutions":["Grant microphone permission in site settings and start recognition again","Call navigator.mediaDevices.getUserMedia({ audio: true }) once to force the native permission prompt before starting recognition","In Electron, approve 'media' requests via session.setPermissionRequestHandler","If permission stays denied, switch the transcription provider in settings instead of expecting Web Speech API to recover"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const perm = await navigator.permissions.query({ name: 'microphone' as PermissionName })\nif (perm.state !== 'granted') {\n  // trigger the native prompt once via getUserMedia\n  await navigator.mediaDevices.getUserMedia({ audio: true })\n}","typeGuard":null,"tryCatchPattern":"try {\n  await navigator.mediaDevices.getUserMedia({ audio: true })\n  recognition.start()\n}\ncatch (err) {\n  if ((err as DOMException).name === 'NotAllowedError')\n    showPermissionUI()\n}","preventionTips":["Warm microphone permission during onboarding before enabling speech features","In Electron, approve 'media' permission requests explicitly","Do not retry start() in a loop while permission is denied - wait for a user action"],"tags":["web-speech-api","microphone-permission","permissions","browser"],"backgroundTag":"microphone-permission-denied","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}