{"record":{"id":"d1be18f96fcda251","repo":"sgl-project/sglang","slug":"language-language-is-not-in-this-whisper-model","errorCode":null,"errorMessage":"Language '{language}' is not in this Whisper model's vocabulary. The '{language_token}' token may have been added in a later Whisper version than the loaded checkpoint.","messagePattern":"Language '(.+?)' is not in this Whisper model's vocabulary\\. The '(.+?)' token may have been added in a later Whisper version than the loaded checkpoint\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/whisper.py","lineNumber":159,"sourceCode":"    def _pop_sampling_param(self, request_obj, key: str):\n        sampling_params = getattr(request_obj, \"sampling_params\", None) or {}\n        return sampling_params.pop(key, None)\n\n    def _get_language_token_id(self, language: Optional[str]) -> int:\n        # Default to English if not specified\n        if language is None:\n            language = \"en\"  # Default to English\n        language_token = f\"<|{language}|>\"\n        token_id = self._tokenizer.convert_tokens_to_ids(language_token)\n        # normalize_language_to_code accepts the full Whisper language-token\n        # vocab (including yue/haw/jw) so fused autodetect output round-trips.\n        # Older checkpoints (v1/v2) don't have every newer token in their\n        # vocab, in which case convert_tokens_to_ids returns the unk id.\n        # Raise a clean error here instead of silently feeding unk into the\n        # decoder and producing garbage.\n        unk_id = getattr(self._tokenizer, \"unk_token_id\", None)\n        if token_id is None or (unk_id is not None and token_id == unk_id):\n            raise ValueError(\n                f\"Language '{language}' is not in this Whisper model's vocabulary. \"\n                f\"The '{language_token}' token may have been added in a later \"\n                f\"Whisper version than the loaded checkpoint.\"\n            )\n        return token_id\n\n    async def process_mm_data_async(\n        self,\n        image_data,\n        audio_data,\n        input_text,\n        request_obj,\n        **kwargs,\n    ) -> Optional[Dict[str, Any]]:\n        if not audio_data:\n            return None\n\n        if len(audio_data) != 1:","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/whisper.py#L141-L177","documentation":"Whisper language tokens (e.g. '<|zh|>') were added incrementally across Whisper releases. When the loaded checkpoint's tokenizer maps the token to unk or None, the processor raises this clean ValueError instead of silently decoding garbage. It means the language is valid Whisper-wise but newer than the checkpoint's vocabulary.","triggerScenarios":"Loading a Whisper v2 checkpoint and requesting a language whose token was only introduced in v3 (token_id is None or equals unk_token_id in _get_language_token_id).","commonSituations":"Mixing openai/whisper-large-v3 requests against a small/turbo checkpoint; community fine-tunes with trimmed vocabularies; CI upgrading language lists without upgrading weights.","solutions":["Use a newer/larger Whisper checkpoint that includes the language token","Pick a different language supported by the loaded checkpoint","Pin the model version known to contain your required languages"],"exampleFix":"# before\nmodel = openai/whisper-small  # older vocab\nlanguage = '<newer-language>'\n# after\nmodel = openai/whisper-large-v3  # includes newer language tokens","handlingStrategy":"fallback","validationCode":"tok = processor._tokenizer\ntid = tok.convert_tokens_to_ids(lang_token)\nif tid in (None, getattr(tok, 'unk_token_id', None)):\n    raise ValueError(f'{lang_token} unavailable in this checkpoint')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin a checkpoint version known to cover your language set","Validate language tokens against the loaded tokenizer at startup, not per-request"],"tags":["whisper","audio","tokenizer-vocab","model-version"],"backgroundTag":"token-not-in-vocabulary","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}