moeru-ai/airi · warning
[WhisperAdapter] Restarting in
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).
Solutions
- Capture the worker's own error in devtools before this warn to find the root cause.
- Reduce concurrent model loads (the GPU coordinator / load queue exists for this) to avoid OOM.
- Fix worker bundling if ensureWorker fails instantly (check the worker URL loads standalone).
- After 'terminated', obtain a fresh adapter (the getKokoroAdapter-style singleton reset) instead of retrying the dead one.
Defensive patterns
Strategy: retry
Prevention
- Reset restartAttempts on success (onSuccess) so transient crashes do not accumulate toward termination.
- Check state === 'terminated' before invoking the adapter and recreate it when needed.
- Fix worker bundling issues before shipping: a 404 worker script produces instant restart loops.
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
- [InferenceWorkerManager] Restarting worker in
- [KokoroAdapter] Restarting in
- [WhisperAdapter] device-loss events recorded, promoting…
- Failed to initialize voice activity detection.
- [GPU] Memory pressure
AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18).
Data as JSON: /api/errors/7e967d1076eca91d.
Report an issue: GitHub.
Appendix: 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)