unslothai/unsloth · warning · TimeoutError

model load did not reach ready within {timeout_s}s

Error message

model load did not reach ready within {timeout_s}s

What it means

Thrown by AudioAttachmentAdapter.add (audio-attachment-adapter.ts:61-65) via getAudioSizeError (audio-utils.ts:10-14) when the picked file's byte size exceeds MAX_AUDIO_SIZE = 25MB (kept in sync with the backend limit STT_AUDIO_RAW_MAX_BYTES). It fires at attach time with a toast, before any upload.

Source

Thrown at scripts/diffusion_bench.py:174


def _wait_for_load(backend: Any, timeout_s: int = 2400) -> None:
    deadline = time.time() + timeout_s
    last = None
    while time.time() < deadline:
        p = backend.load_progress()
        phase = p.get("phase")
        if phase != last:
            last = phase
            frac = p.get("fraction") or 0.0
            bt = (p.get("bytes_total") or 0) / 1e9
            print(f"  load phase={phase} frac={frac:.3f} total={bt:.2f}GB", flush = True)
        if phase == "ready":
            return
        if phase == "error":
            raise RuntimeError(f"load error: {p.get('error')}")
        time.sleep(2)
    raise TimeoutError(f"model load did not reach ready within {timeout_s}s")


def _generate_once(backend: Any, args: argparse.Namespace) -> Any:
    """One generation at the fixed seed; returns the first PIL image."""
    result = backend.generate(
        prompt = args.prompt,
        width = args.width,
        height = args.height,
        steps = args.steps,
        guidance = args.guidance,
        seed = args.seed,
        batch_size = args.batch_size,
    )
    images = result["images"]
    return images[0]


def _run(args: argparse.Namespace) -> dict[str, Any]:

View on GitHub (pinned to 203007d190)

Solutions

  1. Compress or trim the audio to under 25MB (convert WAV to MP3/OGG at a modest bitrate, or cut the clip).
  2. Split long recordings into multiple messages — but note only one audio file is allowed per message, so split across messages.
  3. As a developer integrating programmatically, check getAudioSizeError(file.size) before calling add() to give a cleaner error.

Example fix

// before: attach raw WAV
adapter.add({ file });

// after: pre-validate and down-encode
if (getAudioSizeError(file.size)) {
  file = await reencodeAudio(file, { format: 'audio/mpeg', bitrate: 64000 });
}
Defensive patterns

Strategy: validation

Validate before calling

import { getAudioSizeError, MAX_AUDIO_SIZE } from '@/lib/audio-utils';

function audioSizeOk(file: File): boolean {
  return getAudioSizeError(file.size) === null; // file.size <= MAX_AUDIO_SIZE (25MB)
}

Try / catch

if (!audioSizeOk(file)) {
  toast.error(`Compress the audio below ${MAX_AUDIO_SIZE_LABEL} before attaching.`);
} else {
  await adapter.add({ file });
}

Prevention

When it happens

Trigger: Selecting any audio file with file.size > 26214400 bytes — e.g. a 40MB WAV (uncompressed WAV reaches 25MB in ~2.5 minutes at 16-bit 44.1kHz stereo), long FLAC recordings, or a mislabeled video file accepted by the extension-based accept list.

Common situations: Long voice memos recorded as WAV/FLAC; users re-attaching podcasts; lossless rips of interviews. The size check is client-side, so it only triggers in the picker, not on programmatic sends.

Understand the failure class

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/10d1ae9dc8c06bfb. Report an issue: GitHub.