{"record":{"id":"b459530fca52d191","repo":"unslothai/unsloth","slug":"model-id-is-still-cancelling-try-again-in-a-m-b45953","errorCode":null,"errorMessage":"'{model_id}' is still cancelling; try again in a moment.","messagePattern":"'(.+?)' is still cancelling; try again in a moment\\.","errorType":"http","errorClass":"SttModelIdError","httpStatus":422,"severity":"warning","filePath":"studio/backend/core/inference/stt_mtmd_sidecar.py","lineNumber":404,"sourceCode":"            )\n            return min(done, total) if total is not None else done\n        except Exception:\n            return None\n\n    def start(\n        self,\n        model_id: str,\n        hf_token: Optional[str] = None,\n    ) -> None:\n        model_id = resolve_mtmd_model_id(model_id)\n        hub_cache = _capture_stt_hub_cache()\n        with self._lock:\n            if self._thread is not None and self._thread.is_alive():\n                if self._model_id == model_id:\n                    # Joining a cancelling run would silently download nothing.\n                    if not self._cancelled:\n                        return\n                    raise SttModelIdError(\n                        f\"'{model_id}' is still cancelling; try again in a moment.\"\n                    )\n                raise SttModelIdError(\n                    f\"Another dictation model ('{self._model_id}') is still \"\n                    \"downloading; wait for it to finish.\"\n                )\n            self._model_id = model_id\n            self._error = None\n            self._total_bytes = None\n            self._selected_files = ()\n            self._revision = None\n            self._hub_cache = hub_cache\n            self._cancelled = False\n            self._process = None\n            thread = threading.Thread(\n                target = self._run,\n                args = (model_id, hf_token),\n                daemon = True,","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/stt_mtmd_sidecar.py#L386-L422","documentation":"SttModelIdError raised in the mtmd downloader's start routine: a download thread for the SAME model_id is still alive and its _cancelled flag is set — i.e. a cancel was requested but the thread has not finished unwinding yet. Joining it would make the caller wait on a run that will download nothing, so the request is bounced instead. The wording is misleading: it means 'cancel still in progress', not a bad model id.","triggerScenarios":"Calling download(model_id) for model X, then immediately calling download(X) again after cancelling the first: self._thread.is_alive() and self._cancelled are both True.","commonSituations":"Rapid cancel-then-restart of a download in the Settings UI; double-click on Download after clicking Cancel; cancel fired but the HF download thread is still in its teardown.","solutions":["Retry after a short delay — the old thread exits once its cancel path completes.","In the UI, disable the Download button while a cancel is pending instead of allowing the immediate re-request.","Poll the downloader state until no thread is alive before restarting the download."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"with downloader._lock:  # prefer a public status accessor if exposed\n    busy = downloader._thread is not None and downloader._thread.is_alive()\n    cancelling = busy and downloader._cancelled\nif cancelling:\n    wait_then_retry(model_id)","typeGuard":null,"tryCatchPattern":"try:\n    downloader.download(model_id)\nexcept SttModelIdError as exc:\n    if \"still cancelling\" in str(exc):\n        time.sleep(0.5)\n        downloader.download(model_id)","preventionTips":["Disable the Download button while a cancel is pending in the UI.","Wait for the previous thread to report idle before restarting a download.","Debounce rapid cancel/restart clicks on model cards."],"tags":["stt","mtmd","download","cancellation","race"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}