{"record":{"id":"83cead812f65795c","repo":"unslothai/unsloth","slug":"language-language-is-not-supported-by-english","errorCode":null,"errorMessage":"Language '{language}' is not supported by English-only STT model '{model_id}'.","messagePattern":"Language '(.+?)' is not supported by English-only STT model '(.+?)'\\.","errorType":"http","errorClass":"SttLanguageError","httpStatus":422,"severity":"error","filePath":"studio/backend/core/inference/stt_sidecar.py","lineNumber":1678,"sourceCode":"        \"\"\"\n        # Reject a missing runtime up front, before the cache and bounded decode.\n        ensure_stt_available()\n        if cancel_event is not None and cancel_event.is_set():\n            raise SttTranscriptionCancelledError(\"Transcription cancelled.\")\n        # A set language beats auto-detect. API takes BCP-47; Whisper wants short\n        # codes like en or fr.\n        lang = normalize_whisper_language(language)\n        # Pin the requested id: another request may switch the resident model\n        # mid-transcription, so sidecar state is not this request's identity.\n        model_id = resolve_model_id(model)\n        known_languages = _known_whisper_languages()\n        if lang is not None and known_languages is not None and lang not in known_languages:\n            raise SttLanguageError(\n                f\"Language '{language}' is not supported by STT model '{model_id}'.\"\n            )\n        cached = self._ensure_model_downloaded(model_id)\n        if cached.is_multilingual is False and lang not in (None, \"en\"):\n            raise SttLanguageError(\n                f\"Language '{language}' is not supported by English-only STT model '{model_id}'.\"\n            )\n        decoded_audio = _decode_audio_bounded(audio, cancel_event)\n        if cancel_event is not None and cancel_event.is_set():\n            raise SttTranscriptionCancelledError(\"Transcription cancelled.\")\n        # condition_on_prev_tokens=False stops a fresh clip inheriting prior\n        # context, which causes runaway repeats.\n        generate_kwargs = {\n            \"task\": \"transcribe\",\n            \"condition_on_prev_tokens\": False,\n            \"num_beams\": 5,\n        }\n        if lang is not None:\n            generate_kwargs[\"language\"] = lang\n        if fast:\n            # Short voiced clips: greedy decoding drops beam search for latency.\n            generate_kwargs[\"num_beams\"] = 1\n        # Serialize inference with model switches and unloads.","sourceCodeStart":1660,"sourceCodeEnd":1696,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/stt_sidecar.py#L1660-L1696","documentation":"Raised when a language other than English (or None) is requested for an English-only Whisper model (the '.en' variants). The check happens after _ensure_model_downloaded, whose cached metadata reports is_multilingual=False. Whisper .en models were trained only on English, so a non-English language request can never be honored.","triggerScenarios":"Resolving model_id to an English-only checkpoint (e.g. 'whisper-base.en') and calling transcribe with language set to anything other than None or 'en'. The metadata lookup cached.is_multilingual is False triggers the refusal.","commonSituations":"Default model id points at a '.en' checkpoint while the app lets users pick any language; migrating from a multilingual model to a smaller '.en' one and forgetting to constrain the language picker; auto-detect requests passing a hardcoded language like 'fr'.","solutions":["Switch to the multilingual variant of the model (drop the '.en' suffix, e.g. whisper-base instead of whisper-base.en).","Drop the language argument (None) or set it to 'en' when the English-only model must stay.","Check the model's is_multilingual flag from the download cache before offering non-English languages in the UI."],"exampleFix":"# before\ntranscribe(audio, model='whisper-base.en', language='fr')\n\n# after\ntranscribe(audio, model='whisper-base', language='fr')  # multilingual model","handlingStrategy":"validation","validationCode":"cached = stt._ensure_model_downloaded(model_id)  # or query your model registry\ndef allows_language(cached, language):\n    from core.inference.stt_sidecar import normalize_whisper_language\n    lang = normalize_whisper_language(language)\n    return cached.is_multilingual is not False or lang in (None, 'en')","typeGuard":"def model_accepts_language(is_multilingual: bool | None, language: str | None) -> bool:\n    lang = normalize_whisper_language(language)\n    return is_multilingual is not False or lang in (None, 'en')","tryCatchPattern":"from core.inference.stt_sidecar import SttLanguageError\ntry:\n    text = stt.transcribe(audio, model=model_id, language=lang)\nexcept SttLanguageError:\n    text = stt.transcribe(audio, model=multilingual_model_id, language=lang)","preventionTips":["Read is_multilingual from the download cache before exposing non-English options.","Ban '.en' model ids in configurations that serve multiple languages.","Treat English-only models as a deployment choice, not a per-request one."],"tags":["stt","whisper","language","model-config"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}