moeru-ai/airi · warning

[WhisperAdapter] Restarting in ${delay}ms (attempt ${restart

Error message

[WhisperAdapter] Restarting in ${delay}ms (attempt ${restartAttempts}/${MAX_RESTARTS})

What it means

WhisperAdapter supervises its transcription worker with the same bounded-restart policy as Kokoro: on worker failure scheduleRestart() waits RESTART_DELAY_MS × attempt and calls ensureWorker() again, warning per attempt. At MAX_RESTARTS it logs an error and sets state 'terminated' so callers can detect the dead adapter rather than waiting in 'error' forever. A successful restart clears the counter (onSuccess).

Source

Thrown at packages/stage-ui/src/libs/inference/adapters/whisper.ts:185

      messageListener = null
      errorListener = null
      worker.terminate()
      worker = null
    }
  }

  function scheduleRestart(): void {
    if (restartAttempts >= MAX_RESTARTS) {
      console.error(`[WhisperAdapter] Max restart attempts (${MAX_RESTARTS}) reached.`)
      // NOTICE: Transition to 'terminated' so callers can detect the dead adapter
      // instead of being stuck in 'error' state indefinitely.
      state = 'terminated'
      return
    }

    restartAttempts++
    const delay = RESTART_DELAY_MS * restartAttempts
    console.warn(`[WhisperAdapter] Restarting in ${delay}ms (attempt ${restartAttempts}/${MAX_RESTARTS})`)

    setTimeout(() => {
      ensureWorker()
    }, delay)
  }

  function onSuccess(): void {
    restartAttempts = 0
  }

  function ensureWorker(): Worker {
    if (!worker) {
      worker = new Worker(workerUrl, { type: 'module' })
      messageListener = (event: MessageEvent) => {
        const data = event.data
        // Forward unified protocol messages to subscribers
        if (data.type === 'progress') {
          const evt: WhisperEvent = { type: 'progress', payload: data.payload }

View on GitHub (pinned to 677329427f)

Solutions

  1. Capture the worker's own error in devtools before this warn to find the root cause.
  2. Reduce concurrent model loads (the GPU coordinator / load queue exists for this) to avoid OOM.
  3. Fix worker bundling if ensureWorker fails instantly (check the worker URL loads standalone).
  4. After 'terminated', obtain a fresh adapter (the getKokoroAdapter-style singleton reset) instead of retrying the dead one.
Defensive patterns

Strategy: retry

Prevention

When it happens

Trigger: Worker crash while loading or running the Whisper model (WASM abort, OOM), onnxruntime-web failures under webgpu execution provider, or the worker script failing to instantiate (404/bundle error).

Common situations: Memory-constrained tabs running ASR + TTS together; bundler misconfig serving a broken worker chunk; version skew between transformers.js and the whisper ONNX artifacts.

Related errors


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