moeru-ai/airi · warning

Web Speech API error:

Error message

Web Speech API error:

What it means

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.

Source

Thrown at packages/stage-ui/src/libs/providers/providers/browser-web-speech-api/provider.ts:266

      const delta: StreamTranscriptionDelta = {
        type: 'transcript.text.delta',
        delta: trimmedTranscript,
      }
      fullStreamCtrl?.enqueue(delta)
      textStreamCtrl?.enqueue(trimmedTranscript)
      options?.onSentenceEnd?.(trimmedTranscript)
      console.info('Web Speech API transcribed (final):', trimmedTranscript)
    }

    // Log interim results for debugging (don't emit as final)
    if (interimTranscript && recognition.interimResults) {
      console.info('Web Speech API transcribed (interim):', interimTranscript)
    }
  }

  recognition.onerror = (event: any) => {
    const errorType = event.error || 'unknown'
    console.warn('Web Speech API error:', errorType)

    if (errorType === 'no-speech') {
      return
    }

    if (errorType === 'audio-capture') {
      console.warn('Web Speech API: Microphone access issue. Please check microphone permissions.')
      return
    }

    if (errorType === 'network' || errorType === 'aborted') {
      return
    }
    const error = new Error(`Speech recognition error: ${errorType}`)
    fullStreamCtrl?.error(error)
    textStreamCtrl?.error(error)
    deferredText.reject(error)
    deferredText.isRejected = true

View on GitHub (pinned to 677329427f)

Solutions

  1. 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).
  2. Use a supported BCP-47 language tag for recognition.lang.
  3. For extended sessions, expect periodic network/no-speech events in continuous mode — they are already ignored by this provider.
  4. If the environment blocks the cloud service (offline, kiosk), switch to a different transcription provider (e.g. whisper-based).
Defensive patterns

Strategy: try-catch

Validate before calling

function isSpeechRecognitionAvailable(): boolean {
  return typeof window !== 'undefined'
    && !!(window.SpeechRecognition || window.webkitSpeechRecognition)
}
if (!isSpeechRecognitionAvailable()) {
  // fall back to another transcription provider
}

Type guard

type SpeechErrorCode =
  | 'no-speech' | 'aborted' | 'audio-capture' | 'network'
  | 'not-allowed' | 'service-not-allowed' | 'language-not-supported' | 'unknown'
function isbenignSpeechError(code: string): code is Exclude<SpeechErrorCode, 'not-allowed' | 'service-not-allowed' | 'language-not-supported'> {
  return ['no-speech', 'aborted', 'audio-capture', 'network'].includes(code)
}

Try / catch

recognition.onerror = (event: SpeechRecognitionErrorEvent) => {
  const code = event.error || 'unknown'
  if (isbenignSpeechError(code)) return
  // propagate as stream error for actionable codes
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18). Data as JSON: /api/errors/415d3693460290fc. Report an issue: GitHub.