unslothai/unsloth · info · SttTranscriptionCancelledError
Transcription cancelled.
Error message
Transcription cancelled.
What it means
Raised in the STT worker child's command loop after transcribe_window returns: the command was marked cancellable and the shared cancel event is set, so the child reports SttTranscriptionCancelledError instead of sending the (possibly truncated) text. It is the child-side twin of the parent's cancellation check.
Source
Thrown at studio/backend/core/inference/stt_transformers_worker.py:274
"is_multilingual": (
is_multilingual if isinstance(is_multilingual, bool) else None
),
},
)
elif kind == "transcribe":
if engine is None:
raise SttWorkerError("The dictation worker has no model loaded.")
cancellable = bool(command.get("cancellable"))
text = transcribe_window(
engine[0],
engine[1],
command["audio"],
command.get("generate_kwargs") or {},
cancel_event if cancellable else None,
)
if cancellable and cancel_event.is_set():
from core.inference.stt_sidecar import SttTranscriptionCancelledError
raise SttTranscriptionCancelledError("Transcription cancelled.")
_send(resp_queue, {"type": "text", "text": text})
elif kind == "shutdown":
_send(resp_queue, {"type": "shutdown_ack"})
return
else:
_send(
resp_queue,
{
"type": "error",
"kind": "SttWorkerError",
"error": f"Unknown command '{kind}'.",
},
)
except BaseException as exc: # noqa: BLE001 - every failure is reported, then handled
_send(resp_queue, _error_response(exc))
if kind == "load":
# Nothing is resident after a failed load, and the attempt may
# already have taken a context; exiting returns it.View on GitHub (pinned to 203007d190)
Solutions
- Catch SttTranscriptionCancelledError on the parent side (it arrives via the error channel) and map it to a 'cancelled' response, not a 500.
- If partial text is wanted despite cancellation, send cancellable=False and rely on the stop criteria only to shorten generation.
- Ensure the UI stops treating a cancelled window as a failed request.
Example fix
# before
resp = worker_client.transcribe(pcm, generate_kwargs, cancellable=True)
# worker raises SttTranscriptionCancelledError -> surfaced as generic error
# after
try:
resp = worker_client.transcribe(pcm, generate_kwargs, cancellable=True)
except SttTranscriptionCancelledError:
resp = {'text': '', 'cancelled': True} Defensive patterns
Strategy: try-catch
Validate before calling
if cancellable and cancel_event is not None and cancel_event.is_set():
return {'text': '', 'cancelled': True} Try / catch
from core.inference.stt_sidecar import SttTranscriptionCancelledError
try:
text = worker.transcribe(pcm, kwargs, cancellable=True)
except SttTranscriptionCancelledError:
text = '' # user stopped; not an error Prevention
- Set cancellable=False for fire-and-forget windows where partial text is still useful.
- Keep one owner per cancel event (the request handler), and clear or replace it per request.
- Distinguish 'cancelled' from 'failed' in the response contract so the UI renders them differently.
When it happens
Trigger: Sending a {'type': 'transcribe', 'cancellable': True, ...} command to the worker while the parent sets cancel_event — either mid-generation (stopping the beam search via the StoppingCriteria) or right as it finishes.
Common situations: A stop button on a live dictation session; per-request timeouts backed by an event; racing a shutdown with an in-flight transcription window.
Related errors
- Diffusion generation was cancelled.
- '{model_id}' is still cancelling; try again in a moment.
- Another GGUF dictation model ('{self._model_id}') is still d
- Transcription cancelled.
- GGUF STT model loading was cancelled.
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/bf4d6628b9f677d9.
Report an issue: GitHub.