unslothai/unsloth · info · SttTranscriptionCancelledError

Transcription cancelled.

Error message

Transcription cancelled.

What it means

SttTranscriptionCancelledError raised at the top of load(): if the caller passed a request_cancel_event and it is already set, the load aborts before resolving the model or taking _start_lock. It is the cheap first cancellation checkpoint of a load request.

Source

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

        sock.bind(("127.0.0.1", 0))
        return sock, sock.getsockname()[1]

    def _ensure_model_downloaded(self, model_id: str) -> tuple[str, str]:
        paths = _cached_model_paths(model_id)
        if paths is None:
            raise SttModelNotDownloadedError(
                f"STT model '{model_id}' is not downloaded. "
                "Download it in Settings, then Voice, before loading it."
            )
        return paths

    def load(
        self,
        model: Optional[str] = None,
        request_cancel_event: Optional[threading.Event] = None,
    ) -> None:
        if request_cancel_event is not None and request_cancel_event.is_set():
            raise SttTranscriptionCancelledError("Transcription cancelled.")
        self._raise_if_update_in_progress()
        model_id = resolve_mtmd_model_id(model)
        binary = ensure_engine_available()
        # Startup happens outside _lock (it is slow), so this keeps two callers
        # from each spawning a server and orphaning the first.
        with self._start_lock:
            if request_cancel_event is not None and request_cancel_event.is_set():
                raise SttTranscriptionCancelledError("Transcription cancelled.")
            self._raise_if_update_in_progress()
            self._load_locked(model_id, binary, request_cancel_event)

    def _load_locked(
        self,
        model_id: str,
        binary: str,
        request_cancel_event: Optional[threading.Event] = None,
    ) -> None:
        with self._lock:

View on GitHub (pinned to 203007d190)

Solutions

  1. Treat as expected cancellation: stop the dictation flow, do not retry.
  2. If loads are being cancelled unintentionally, audit who shares the cancel event and its lifetime.
  3. Pass a fresh threading.Event per request so unrelated cancels do not leak between requests.
Defensive patterns

Strategy: try-catch

Validate before calling

```python
if request_cancel_event is not None and request_cancel_event.is_set():
    return  # skip the load entirely
```

Try / catch

```python
try:
    sidecar.load(model, request_cancel_event=ev)
except SttTranscriptionCancelledError:
    return {"status": "cancelled"}
```

Prevention

When it happens

Trigger: load(model, request_cancel_event=ev) invoked after ev.set() — e.g. the user released/aborted the dictation recording before the load call ran.

Common situations: UI cancel racing a background preload; a keep-alive warmup whose owning request was cancelled first; cancel event set during audio decode so the subsequent load sees it set.

Related errors


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