moeru-ai/airi · warning

Error stopping recognition instance:

Error message

Error stopping recognition instance:

What it means

In the transcription provider settings test, testRecognitionInstance.value.stop() threw during stopSTTTest — usually because the recognition already stopped or was aborted first. The nested catch keeps the outer teardown going: the instance reference is nulled and the abort controller fires afterwards. UI state still lands on 'Stopped'.

Source

Thrown at packages/stage-pages/src/pages/settings/providers/transcription/browser-web-speech-api.vue:261

    testStatusMessage.value = `Error: ${testTranscriptionError.value}`
    isTranscribing.value = false
    isTestingSTT.value = false
    console.error('Web Speech API test error:', err)
  }
}

async function stopSTTTest() {
  isTestingSTT.value = false
  isTranscribing.value = false
  testStatusMessage.value = 'Stopped'

  try {
    // Stop recognition instance if we have one
    if (testRecognitionInstance.value) {
      try {
        testRecognitionInstance.value.stop()
      }
      catch (err) { console.warn('Error stopping recognition instance:', err) }
      testRecognitionInstance.value = null
    }

    // Abort the abort controller
    if (testAbortController.value && !testAbortController.value.signal.aborted) {
      testAbortController.value.abort()
      testAbortController.value = null
    }
  }
  catch (err) {
    console.error('Error stopping STT test:', err)
  }

  // Finalize transcription if we have streaming text
  if (testStreamingText.value.trim() && !testTranscriptionText.value) {
    testTranscriptionText.value = testStreamingText.value.trim()
  }

View on GitHub (pinned to 677329427f)

Solutions

  1. Ignore the warning — UI state resets to 'Stopped' regardless
  2. Make stopSTTTest idempotent: early-return when isTestingSTT is already false
  3. Null the instance reference before calling stop() to prevent double-stop
  4. Catch InvalidStateError specifically and stay quiet on it
Defensive patterns

Strategy: try-catch

Validate before calling

if (!testRecognitionInstance.value) return // nothing to stop (source guard)

Try / catch

try {
  testRecognitionInstance.value.stop()
}
catch (err) {
  console.warn('Error stopping recognition instance:', err) // InvalidStateError expected on double-stop
}
testRecognitionInstance.value = null // always drop the reference (source pattern)

Prevention

When it happens

Trigger: Clicking Stop after the test recognition already ended; the test timeout aborted the controller first; double-clicking the stop button.

Common situations: Tester double-clicks Stop; test timed out and the user clicks Stop afterwards; permission prompt dismissed mid-test.

Related errors


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