unslothai/unsloth · info · SttLoadCancelledError

Dictation model loading was cancelled so training could star

Error message

Dictation model loading was cancelled so training could start.

What it means

SttLoadCancelledError raised when _wait_for_server() returns False and the cancel event is set: the freshly spawned llama-server never became ready and was cancelled (typically preempted by a training run that needs the VRAM). The half-started process is reaped before raising so no port or VRAM leaks.

Source

Thrown at studio/backend/core/inference/stt_mtmd_sidecar.py:924

                # Bundled libs and pip CUDA runtimes on the loader path, secrets
                # scrubbed, as the chat backend spawns the same binary.
                env = _llama_server_child_env(binary),
                # Die with Studio, so a crash never orphans a server on the GPU.
                **child_popen_kwargs(),
            )
            # Published before the wait, so training can preempt a startup that
            # is already allocating; _process is not set for another 180s.
            with self._lock:
                self._starting_process = process
            adopt_pid(process.pid)  # terminate_all backstop for graceful exits
            if not self._wait_for_server(process, port, cancel_event):
                # Reap it here: _process was never assigned, so unload() cannot
                # reach a child that ignores SIGTERM and keeps port and VRAM.
                _reap(process)
                if cancel_event.is_set():
                    # 409 through the route, like the other sidecars: expected
                    # preemption, not a broken or missing runtime (501).
                    raise SttLoadCancelledError(
                        "Dictation model loading was cancelled so training could start."
                    )
                raise SttUnavailableError(f"llama-server did not become ready for '{model_id}'.")
            with self._lock:
                self._process = process
                self._port = port
                self._model_id = model_id
                self._gpu_disabled = training
                self._generation += 1
                self._schedule_idle_unload_locked()
        finally:
            with self._lock:
                self._loading = False
                self._load_cancel_event = None
                self._load_owner_cancel_event = None
                self._starting_process = None

    @staticmethod

View on GitHub (pinned to 203007d190)

Solutions

  1. Treat as expected preemption (surfaces as 409): let the user re-run dictation after training starts or completes.
  2. If training and dictation collide often, preload the dictation model before launching training runs.
  3. If it fires with no training active, check that nothing else is setting the shared cancel event.
Defensive patterns

Strategy: try-catch

Try / catch

```python
try:
    sidecar.load(model_id)
except SttLoadCancelledError:
    return {"status": "preempted-by-training"}, 409  # retry after training ends
```

Prevention

When it happens

Trigger: A training run (or explicit cancel) sets the load's cancel event while llama-server is still in its up-to-180s startup window — the readiness wait is aborted.

Common situations: User starts a fine-tune right after beginning to dictate; GPU is slow to allocate and the wait is preempted; keep-alive preload cancelled by a scheduled training job.

Related errors


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