{"record":{"id":"6595e1316b412a7f","repo":"unslothai/unsloth","slug":"another-dictation-model-self-model-id-is-st-6595e1","errorCode":null,"errorMessage":"Another dictation model ('{self._model_id}') is still downloading; wait for it to finish.","messagePattern":"Another dictation model \\('(.+?)'\\) is still downloading; wait for it to finish\\.","errorType":"http","errorClass":"SttModelIdError","httpStatus":422,"severity":"warning","filePath":"studio/backend/core/inference/stt_sidecar.py","lineNumber":803,"sourceCode":"\n    def start(\n        self,\n        model_id: str,\n        hf_token: Optional[str] = None,\n        revision: Optional[str] = None,\n    ) -> None:\n        model_id = resolve_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._repo = resolve_model_repo(model_id)\n            self._revision = None\n            self._hub_cache = hub_cache\n            self._error = None\n            self._total_bytes = None\n            self._selected_files = ()\n            self._complete = False\n            self._cancelled = False\n            self._process = None\n            thread = threading.Thread(\n                target = self._run,\n                args = (self._repo, hf_token, revision),\n                daemon = True,\n            )","sourceCodeStart":785,"sourceCodeEnd":821,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/stt_sidecar.py#L785-L821","documentation":"Raised when a download is requested for model B while the download thread for a different model A is still running. The manager is single-flight: only one dictation model download at a time, so any second, different model_id is rejected with the id of the in-flight download.","triggerScenarios":"Calling download('whisper-large-v3') while download('whisper-base') is still in progress (self._thread alive, self._model_id != requested model_id). Note: re-requesting the SAME id returns silently; only a different id raises.","commonSituations":"A Settings page letting the user pick another Voice model while one is downloading; background prefetch code racing with a user-initiated download; retry logic that switches model ids on failure.","solutions":["Wait for the in-flight download of the model named in the message to finish, then retry.","Cancel the current download first, then wait for its cancel to complete (avoiding error 400), then start the new one.","Serialize downloads through a single queue/UI affordance so only one model download can be requested at a time."],"exampleFix":"// before\nstart_download(\"whisper-base\");\nstart_download(\"whisper-large-v3\");  // SttModelIdError\n// after\nawait download_complete_or_cancelled();\nstart_download(\"whisper-large-v3\");","handlingStrategy":"validation","validationCode":"with downloader._lock:\n    active = downloader._model_id if (downloader._thread and downloader._thread.is_alive()) else None\nif active is not None and active != wanted:\n    notify_user_or_wait(active)","typeGuard":"def other_download_active(d, model_id: str) -> bool:\n    with d._lock:\n        return (d._thread is not None and d._thread.is_alive()\n                and d._model_id != model_id)","tryCatchPattern":"try:\n    downloader.download(model_id)\nexcept SttModelIdError as e:\n    # e names the in-flight model; surface a 'wait or cancel' choice\n    handle_choice(e)","preventionTips":["Expose only one download action in the UI at a time","Reuse the same model_id to make duplicate requests idempotent (they return silently)","Queue model switches instead of firing them concurrently"],"tags":["stt","download","concurrency","single-flight","threading"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}