moeru-ai/airi · warning
[KokoroAdapter] Restarting in ${delay}ms (attempt ${restartA
Error message
[KokoroAdapter] Restarting in ${delay}ms (attempt ${restartAttempts}/${MAX_RESTARTS}) What it means
The Kokoro TTS adapter supervises a Web Worker; when the worker errors/terminates, scheduleRestart() applies linear backoff (RESTART_DELAY_MS × attempt) up to MAX_RESTARTS, logging each attempt with this warn. After the cap it logs an error and flips state to 'terminated' so getKokoroAdapter() can replace the dead singleton on next access. The warn itself is healthy self-healing, not a defect.
Source
Thrown at packages/stage-ui/src/libs/inference/adapters/kokoro.ts:288
worker = null
}
}
function scheduleRestart(): void {
if (restartAttempts >= MAX_RESTARTS) {
console.error(
`[KokoroAdapter] Max restart attempts (${MAX_RESTARTS}) reached.`,
)
// NOTICE: Transition to 'terminated' so getKokoroAdapter() can detect
// the dead singleton and create a fresh adapter on next access.
state = 'terminated'
return
}
restartAttempts++
const delay = RESTART_DELAY_MS * restartAttempts
console.warn(
`[KokoroAdapter] Restarting in ${delay}ms `
+ `(attempt ${restartAttempts}/${MAX_RESTARTS})`,
)
setTimeout(() => {
ensureStarted().catch((err) => {
console.error('[KokoroAdapter] Restart failed:', err)
})
}, delay)
}
function onSuccess(): void {
restartAttempts = 0
}
async function ensureStarted(): Promise<void> {
await lifecycleMutex.runExclusive(async () => {
if (!worker) {View on GitHub (pinned to 677329427f)
Solutions
- Reproduce with the worker console open to capture the underlying error (this warn is only the retry signal).
- Lower the model quantization / dtype so the worker uses less memory.
- Update transformers.js / onnxruntime-web to versions compatible with your browser.
- If it reached 'terminated', call getKokoroAdapter() again — it creates a fresh adapter with a fresh restart budget.
Defensive patterns
Strategy: retry
Prevention
- Keep worker restart logic bounded (as done) and always transition to 'terminated' after the cap.
- Access adapters via the getter that replaces terminated singletons instead of caching the instance forever.
- Capture worker-side errors to a report channel so the root cause is not lost behind the retry warn.
When it happens
Trigger: Worker crash from an uncaught exception (WASM abort, OOM in transformers.js), browser killing the worker under memory pressure, or repeated failed model loads during ensureStarted().
Common situations: Low-memory devices loading large Kokoro quantizations; transformers.js/runtime version incompatibility; onnxruntime-web WASM SIMD unsupported so the worker aborts.
Related errors
- [WhisperAdapter] Restarting in ${delay}ms (attempt ${restart
- [InferenceWorkerManager] Restarting worker in ${delay}ms (at
- Kokoro TTS generation failed: No model loaded.
- Unknown Kokoro voice: ${body.voice}
- [Kokoro Worker] Failed with dtype=${attempt.dtype} device=${
AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18).
Data as JSON: /api/errors/ddfd28c915277bdc.
Report an issue: GitHub.