{"record":{"id":"d99105d20d8ecd6f","repo":"unslothai/unsloth","slug":"gguf-stt-model-loading-was-cancelled","errorCode":null,"errorMessage":"GGUF STT model loading was cancelled.","messagePattern":"GGUF STT model loading was cancelled\\.","errorType":"exception","errorClass":"SttLoadCancelledError","httpStatus":409,"severity":"info","filePath":"studio/backend/core/inference/stt_ggml_sidecar.py","lineNumber":992,"sourceCode":"                # A deliberate CPU install must stay CPU: the slim wiring links\n                # every llama ggml backend (including CUDA/ROCm), so without\n                # this flag a cpu-selected install would still grab the GPU.\n                command.append(\"--no-gpu\")\n            logger.info(\n                \"Starting whisper-server for STT model %s on 127.0.0.1:%s\",\n                model_id,\n                port,\n            )\n            cancel_event = (\n                request_cancel_event if request_cancel_event is not None else threading.Event()\n            )\n            with self._load_state_lock:\n                self._load_cancel_event = cancel_event\n                self._load_owner_cancel_event = request_cancel_event\n                self._loading = True\n            try:\n                if cancel_event.is_set():\n                    raise SttLoadCancelledError(\"GGUF STT model loading was cancelled.\")\n                self._release_locked()\n                # Release the reservation as late as possible: whisper-server\n                # binds the port moments after this close.\n                reservation.close()\n                process = subprocess.Popen(\n                    command,\n                    stdout = subprocess.DEVNULL,\n                    stderr = subprocess.DEVNULL,\n                    stdin = subprocess.DEVNULL,\n                    # Co-located GPU libs on the loader path (WSL system HIP first),\n                    # secrets scrubbed from the downloaded binary's env.\n                    env = _whisper_server_child_env(binary),\n                    # Die with Studio (Linux PDEATHSIG, Windows job) so a crash\n                    # never orphans a server holding the model.\n                    **child_popen_kwargs(),\n                )\n                with self._load_state_lock:\n                    self._starting_process = process","sourceCodeStart":974,"sourceCodeEnd":1010,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/stt_ggml_sidecar.py#L974-L1010","documentation":"SttLoadCancelledError raised inside load()'s try block after _load_state_lock registered the load (self._loading=True, _load_cancel_event set): the cancel event is set right before releasing the warm model and spawning whisper-server. This checkpoint keeps the load state machine consistent before the expensive process spawn.","triggerScenarios":"A load switches models (warm model must be unloaded), and between registering the load state and calling _release_locked()/Popen the request_cancel_event (or the internal load cancel event) is set — e.g. training wants the GPU back or the user cancelled.","commonSituations":"Model switch during dictation; training job starting exactly as a cold load begins; a previous load's cancel event being reused for a new load.","solutions":["Catch SttLoadCancelledError and retry the load once the conflicting operation (training) yields, with a fresh cancel event.","Serialize loads: do not start a new load while training acquires the GPU; wait for the coordination event to clear.","Verify the caller is not pre-setting the cancel event it passes in."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    sidecar.load(model_id, request_cancel_event=ev)\nexcept SttLoadCancelledError:\n    retry_after_training_or_user_action(model_id)  # fresh event","preventionTips":["Pass a freshly constructed cancel event on each retry.","Coordinate with training: do not request loads while training claims the engine.","Distinguish SttLoadCancelledError from engine failures in logging pipelines."],"tags":["stt","ggml","cancellation","model-loading"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}