moeru-ai/airi · warning

[Hearing Module] Failed to stop playground monitoring:

Error message

[Hearing Module] Failed to stop playground monitoring:

What it means

During component unmount, the hearing playground fires stopAudioMonitoring() (async teardown of the transcription session, VAD, and stream) as void with a .catch that logs this warning when teardown rejects. Common when stopping something that never fully started. It is deliberately fire-and-forget so unmount never throws; the warn records the cleanup failure cause.

Source

Thrown at packages/stage-pages/src/pages/settings/modules/hearing.vue:331

  await hearingStore.loadModelsForProvider(provider)
  syncOpenAICompatibleSettings()

  const models = providerModels.value
  if (models.length > 0 && !models.some(model => model.id === activeTranscriptionModel.value))
    activeTranscriptionModel.value = models[0].id

  if (shouldRestartMonitoring)
    isMonitoring.value = await setupAudioMonitoring()
}, { immediate: true })

onMounted(async () => {
  syncOpenAICompatibleSettings()
  await askPermission()
})

onUnmounted(() => {
  void stopAudioMonitoring().catch(cause => console.warn('[Hearing Module] Failed to stop playground monitoring:', cause))
})
</script>

<template>
  <div flex="~ col md:row gap-6">
    <div bg="neutral-100 dark:[rgba(0,0,0,0.3)]" rounded-xl p-4 flex="~ col gap-4" class="h-fit w-full md:w-[40%]">
      <div flex="~ col gap-4">
        <!-- Audio Input Selection -->
        <div>
          <FieldCombobox
            v-model="selectedAudioInput"
            label="Audio Input Device"
            description="Select the audio input device for your hearing module."
            :options="audioInputOptions"
            placeholder="Select an audio input device"
            layout="vertical"
          />
        </div>

View on GitHub (pinned to 677329427f)

Solutions

  1. Check the logged cause - it names which stop step rejected
  2. Fix the primary setup failure if this follows an earlier error - cleanup warnings are usually secondary
  3. Make the stop path idempotent so stopping a non-started session resolves instead of rejecting
  4. Safe to disregard in dev HMR unmounts when monitoring state is otherwise consistent

Example fix

// before
onUnmounted(() => {
  void stopAudioMonitoring().catch(cause => console.warn('[Hearing Module] Failed to stop playground monitoring:', cause))
})

// after - skip teardown when nothing is running
onUnmounted(() => {
  if (!isMonitoring.value)
    return
  void stopAudioMonitoring().catch(cause => console.warn('[Hearing Module] Failed to stop playground monitoring:', cause))
})
Defensive patterns

Strategy: try-catch

Validate before calling

if (!isMonitoring.value)
  return
await stopAudioMonitoring()

Try / catch

onUnmounted(() => {
  if (!isMonitoring.value)
    return
  void stopAudioMonitoring().catch((cause) => {
    if (import.meta.env.DEV)
      console.warn('[Hearing Module] Failed to stop playground monitoring:', cause)
  })
})

Prevention

When it happens

Trigger: Unmounting while monitoring never fully started (earlier setup failure); stopping a VAD or provider session whose stop path throws; HMR double-unmount tearing down twice; stopping after the underlying MediaStream was already released elsewhere.

Common situations: Navigating away from hearing settings immediately after toggling monitoring on; dev HMR remount cycles; secondary errors cascading from an earlier permission/stream failure.

Related errors


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