unslothai/unsloth · info · SttLoadCancelledError

Dictation model loading was cancelled.

Error message

Dictation model loading was cancelled.

What it means

SttLoadCancelledError raised inside _load_locked after _loading=True is announced: if the (possibly internally created) cancel_event is set, the startup aborts before checking model download or releasing the current server. The finally block resets _loading/_load_cancel_event so the sidecar state stays consistent.

Source

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

                # optimisation, never worth killing a running transcription
                # for, so an in-flight request keeps the server it has and the
                # next idle load picks the GPU back up.
                if self._gpu_disabled == training or self._active_requests:
                    self._schedule_idle_unload_locked()
                    return
            # Announced before the slow probe and reap: is_loading() is read lock-free,
            # so a training start would otherwise see False and wait out the startup in
            # unload() instead of cancelling this load.
            cancel_event = (
                request_cancel_event if request_cancel_event is not None else threading.Event()
            )
            self._load_cancel_event = cancel_event
            self._load_owner_cancel_event = request_cancel_event
            self._loading = True
            released = False
            try:
                if cancel_event.is_set():
                    raise SttLoadCancelledError("Dictation model loading was cancelled.")
                # Before the release: a 409 for a model that is not downloaded
                # must not cost the user the server they were already using.
                model_path, mmproj_path = self._ensure_model_downloaded(model_id)
                # Only when there is a live server to protect: a request against
                # a server that already died must not block recovery.
                if self._active_requests and self._process_alive():
                    raise SttModelBusyError(
                        "A transcription is still running on the current dictation model. "
                        "Try again in a moment."
                    )
                self._release_locked()
                released = True
            finally:
                # Nothing started, so take the announcement back; past here the startup owns it.
                if not released:
                    self._loading = False
                    self._load_cancel_event = None
                    self._load_owner_cancel_event = None

View on GitHub (pinned to 203007d190)

Solutions

  1. Catch SttLoadCancelledError and treat it as preemption, not failure (the route maps it to 409).
  2. Retry the load once the preemption source (training run) is done, if the user still wants dictation.
  3. Avoid issuing loads while a training run is known to be starting.
Defensive patterns

Strategy: try-catch

Try / catch

```python
try:
    sidecar.load(model_id)
except SttLoadCancelledError:
    return {"status": "cancelled", "retry": True}, 409
```

Prevention

When it happens

Trigger: A cancel or training-preemption signal sets _load_cancel_event between the load entering _load_locked's critical section and the startup body — e.g. unload() for a training run cancels an in-flight startup.

Common situations: Training run starting exactly as a dictation model loads; user cancelling while the lock queue delayed the load; back-to-back model switches where the older request is cancelled.

Related errors


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