{"record":{"id":"415d3693460290fc","repo":"moeru-ai/airi","slug":"web-speech-api-error","errorCode":null,"errorMessage":"Web Speech API error:","messagePattern":"Web Speech API error:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/stage-ui/src/libs/providers/providers/browser-web-speech-api/provider.ts","lineNumber":266,"sourceCode":"      const delta: StreamTranscriptionDelta = {\n        type: 'transcript.text.delta',\n        delta: trimmedTranscript,\n      }\n      fullStreamCtrl?.enqueue(delta)\n      textStreamCtrl?.enqueue(trimmedTranscript)\n      options?.onSentenceEnd?.(trimmedTranscript)\n      console.info('Web Speech API transcribed (final):', trimmedTranscript)\n    }\n\n    // Log interim results for debugging (don't emit as final)\n    if (interimTranscript && recognition.interimResults) {\n      console.info('Web Speech API transcribed (interim):', interimTranscript)\n    }\n  }\n\n  recognition.onerror = (event: any) => {\n    const errorType = event.error || 'unknown'\n    console.warn('Web Speech API error:', errorType)\n\n    if (errorType === 'no-speech') {\n      return\n    }\n\n    if (errorType === 'audio-capture') {\n      console.warn('Web Speech API: Microphone access issue. Please check microphone permissions.')\n      return\n    }\n\n    if (errorType === 'network' || errorType === 'aborted') {\n      return\n    }\n    const error = new Error(`Speech recognition error: ${errorType}`)\n    fullStreamCtrl?.error(error)\n    textStreamCtrl?.error(error)\n    deferredText.reject(error)\n    deferredText.isRejected = true","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/stage-ui/src/libs/providers/providers/browser-web-speech-api/provider.ts#L248-L284","documentation":"The browser Web Speech API recognition object fired its onerror handler; the log prints the SpeechRecognitionErrorCode (e.g. no-speech, audio-capture, not-allowed, network, aborted, language-not-supported, service-not-allowed). The provider treats several codes as benign (no-speech, audio-capture, network, aborted are returned early) and only propagates other codes as stream errors.","triggerScenarios":"Any recognition failure event from SpeechRecognition: silence detected (no-speech), microphone/hardware problems (audio-capture), permission denial (not-allowed), browser speech service unreachable (network / service-not-allowed), unsupported locale (language-not-supported), or programmatic stop (aborted).","commonSituations":"Using Chrome's cloud-backed recognition behind a firewall that blocks Google's speech service; picking a language code the engine lacks; mic muted at OS level; recognition running longer than the service allows; continuous mode restarts racing with abort.","solutions":["Identify the logged errorType and map it: not-allowed → grant mic permission; audio-capture → check mic hardware/OS mute; network/service-not-allowed → ensure access to the browser's speech backend (Chrome's is cloud-based).","Use a supported BCP-47 language tag for recognition.lang.","For extended sessions, expect periodic network/no-speech events in continuous mode — they are already ignored by this provider.","If the environment blocks the cloud service (offline, kiosk), switch to a different transcription provider (e.g. whisper-based)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function isSpeechRecognitionAvailable(): boolean {\n  return typeof window !== 'undefined'\n    && !!(window.SpeechRecognition || window.webkitSpeechRecognition)\n}\nif (!isSpeechRecognitionAvailable()) {\n  // fall back to another transcription provider\n}","typeGuard":"type SpeechErrorCode =\n  | 'no-speech' | 'aborted' | 'audio-capture' | 'network'\n  | 'not-allowed' | 'service-not-allowed' | 'language-not-supported' | 'unknown'\nfunction isbenignSpeechError(code: string): code is Exclude<SpeechErrorCode, 'not-allowed' | 'service-not-allowed' | 'language-not-supported'> {\n  return ['no-speech', 'aborted', 'audio-capture', 'network'].includes(code)\n}","tryCatchPattern":"recognition.onerror = (event: SpeechRecognitionErrorEvent) => {\n  const code = event.error || 'unknown'\n  if (isbenignSpeechError(code)) return\n  // propagate as stream error for actionable codes\n}","preventionTips":["Feature-detect SpeechRecognition before offering the browser provider.","Set a supported recognition.lang and test it once with a short utterance.","Prefer server-side transcription where network access to the speech service is restricted."],"tags":["web-speech-api","speech-recognition","browser-api","microphone"],"backgroundTag":"speech-recognition-error","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}