{"record":{"id":"96506d03be700588","repo":"unslothai/unsloth","slug":"transcription-cancelled","errorCode":null,"errorMessage":"Transcription cancelled.","messagePattern":"Transcription cancelled\\.","errorType":"exception","errorClass":"SttTranscriptionCancelledError","httpStatus":409,"severity":"info","filePath":"studio/backend/core/inference/stt_ggml_sidecar.py","lineNumber":953,"sourceCode":"        return s, s.getsockname()[1]\n\n    def _ensure_model_downloaded(self, model_id: str) -> str:\n        path = _cached_model_path(model_id)\n        if path is None:\n            raise SttModelNotDownloadedError(\n                f\"STT model '{model_id}' (GGUF) is not downloaded. \"\n                \"Download it in Settings, then Voice, before loading it.\"\n            )\n        return path\n\n    def load(\n        self,\n        model: Optional[str] = None,\n        request_cancel_event: Optional[threading.Event] = None,\n    ) -> None:\n        \"\"\"Start (or switch) whisper-server for the requested curated model.\"\"\"\n        if request_cancel_event is not None and request_cancel_event.is_set():\n            raise SttTranscriptionCancelledError(\"Transcription cancelled.\")\n        self._raise_if_update_in_progress()\n        model_id = resolve_ggml_model_id(model)\n        with self._lock:\n            if request_cancel_event is not None and request_cancel_event.is_set():\n                raise SttTranscriptionCancelledError(\"Transcription cancelled.\")\n            self._raise_if_update_in_progress()\n            binary = ensure_engine_available()\n            if self._process_alive() and self._model_id == model_id:\n                self._schedule_idle_unload_locked()\n                return\n            model_path = self._ensure_model_downloaded(model_id)\n            reservation, port = self._reserve_free_port()\n            command = [binary, \"-m\", model_path, \"--host\", \"127.0.0.1\", \"--port\", str(port)]\n            marker = _whisper_install_marker(binary)\n            if _training_active():\n                # Keep whisper.cpp off the accelerator during training (like the\n                # Transformers sidecar's CPU choice) so a mid-training dictation\n                # cannot reclaim the VRAM training just freed.","sourceCodeStart":935,"sourceCodeEnd":971,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/stt_ggml_sidecar.py#L935-L971","documentation":"SttTranscriptionCancelledError raised at the top of GgmlSttSidecar.load(): the caller-supplied request_cancel_event is already set, so the load is aborted before any work. This is the first of three cancellation checkpoints in load() (before the lock, after acquiring the lock, and inside the load sequence).","triggerScenarios":"Calling sidecar.load(model, request_cancel_event=ev) with ev already set — typically the user released the dictation key or cancelled while a load was queued behind the sidecar lock.","commonSituations":"Push-to-talk released during model switch; a training session signals cancellation of pending dictation loads; a UI cancel button races a slow cold load.","solutions":["Treat as a normal cancellation: swallow it in the dictation pipeline and do not show an error to the user.","Clear or create a fresh threading.Event before requesting a new load if the stale event is being reused.","If loads are cancelled unexpectedly, check what sets request_cancel_event (training start, unload, user cancel)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if request_cancel_event is not None and request_cancel_event.is_set():\n    return  # nothing to do","typeGuard":null,"tryCatchPattern":"try:\n    sidecar.load(model_id, request_cancel_event=ev)\nexcept SttTranscriptionCancelledError:\n    pass  # user already cancelled; not an error","preventionTips":["Create a fresh threading.Event per request; never reuse a set one.","Clear the event before re-arming a dictation session.","Silence SttTranscriptionCancelledError in user-facing error reporting."],"tags":["stt","ggml","cancellation","push-to-talk"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}