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 = NoneView on GitHub (pinned to 203007d190)
Solutions
- Catch SttLoadCancelledError and treat it as preemption, not failure (the route maps it to 409).
- Retry the load once the preemption source (training run) is done, if the user still wants dictation.
- 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
- Map SttLoadCancelledError to HTTP 409 so clients distinguish preemption from runtime failure (501).
- Do not start loads you expect to cancel; cancel before calling load.
- After preemption by training, re-load only when the user actually dictates again.
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
- Transcription cancelled.
- Dictation model loading was cancelled so training could star
- '{model_id}' is still cancelling; try again in a moment.
- Transcription cancelled.
- GGUF STT model loading was cancelled.
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/7c2b2145c00254d0.
Report an issue: GitHub.