moeru-ai/airi · warning

1. Microphone permission not granted - browser should prompt

Error message

1. Microphone permission not granted - browser should prompt automatically

What it means

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.

Source

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

  recognition.onsoundend = () => {
    console.info('Web Speech API sound ended')
  }

  recognition.onaudioend = () => {
    console.info('Web Speech API audio capture ended')
  }

  recognition.onnomatch = () => {
    console.info('Web Speech API: No speech match')
  }

  const started = startRecognition()
  if (!started) {
    // If immediate start failed, it might be a permission issue
    // Web Speech API will prompt for permission automatically, so we just log
    console.warn('Web Speech API recognition did not start immediately. This might be due to:')
    console.warn('1. Microphone permission not granted - browser should prompt automatically')
    console.warn('2. Recognition already running - this is normal if called multiple times')
    console.warn('3. Browser requires user gesture - ensure microphone was enabled by user action')

    // Don't retry immediately - wait for permission or user action
    // The recognition instance is already created, so it can be started later if needed
  }

  return {
    fullStream,
    text: deferredText.promise,
    textStream,
    recognition: recognitionInstance,
  }
}

View on GitHub (pinned to 677329427f)

Solutions

  1. Grant microphone permission in site settings and start recognition again
  2. Call navigator.mediaDevices.getUserMedia({ audio: true }) once to force the native permission prompt before starting recognition
  3. In Electron, approve 'media' requests via session.setPermissionRequestHandler
  4. If permission stays denied, switch the transcription provider in settings instead of expecting Web Speech API to recover
Defensive patterns

Strategy: validation

Validate before calling

const perm = await navigator.permissions.query({ name: 'microphone' as PermissionName })
if (perm.state !== 'granted') {
  // trigger the native prompt once via getUserMedia
  await navigator.mediaDevices.getUserMedia({ audio: true })
}

Try / catch

try {
  await navigator.mediaDevices.getUserMedia({ audio: true })
  recognition.start()
}
catch (err) {
  if ((err as DOMException).name === 'NotAllowedError')
    showPermissionUI()
}

Prevention

When it happens

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

Common situations: Fresh install before onboarding's permission step; user blocked the mic then re-enables the hearing feature; iframe without allow='microphone'; kiosk-style embedders.

Related errors


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