{"record":{"id":"06172dd403284734","repo":"sgl-project/sglang","slug":"audio-sr-must-be-positive-got-audio-sr","errorCode":null,"errorMessage":"audio_sr must be positive, got {audio_sr}","messagePattern":"audio_sr must be positive, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/dots_note_omni.py","lineNumber":60,"sourceCode":"    *,\n    seq: int,\n    audio_cap: float,\n    audio_sr: int,\n    max_new_tokens: int,\n) -> dict[str, Any]:\n    if seq <= 0:\n        raise ValueError(f\"seq must be positive, got {seq}\")\n    if max_new_tokens < 0:\n        raise ValueError(f\"max_new_tokens must be non-negative, got {max_new_tokens}\")\n    if max_new_tokens >= seq:\n        raise ValueError(\n            \"max_new_tokens must leave room for input: \"\n            f\"max_new_tokens={max_new_tokens}, seq={seq}\"\n        )\n    if audio_cap < 0:\n        raise ValueError(f\"audio_cap must be non-negative, got {audio_cap}\")\n    if audio_sr <= 0:\n        raise ValueError(f\"audio_sr must be positive, got {audio_sr}\")\n\n    return {\n        \"process_audio\": audio_cap > 0,\n        \"seq_length\": seq - max_new_tokens,\n        \"reserve_interleave\": True,\n        \"audio_token_ratio_cap\": float(audio_cap),\n        \"audio_sample_rate\": int(audio_sr),\n        \"video_jpeg_quality\": int(os.environ.get(\"XHS_VIDEO_JPEG_QUALITY\", \"85\")),\n    }\n\n\ndef _video_payload(raw_video) -> tuple[bytes, str]:\n    if isinstance(raw_video, VideoData):\n        raw_video = raw_video.url\n    raw_url = raw_video.get(\"url\") if isinstance(raw_video, dict) else raw_video\n    video_bytes = get_video_bytes(raw_url)\n    return video_bytes, hashlib.sha1(video_bytes).hexdigest()\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/dots_note_omni.py#L42-L78","documentation":"Raised by _build_video_cfg when audio_sr (audio sample rate) is <= 0. The sample rate is used when resampling/normalizing the audio track of the video, so it must be a positive integer (default 16000).","triggerScenarios":"Passing video_config={\"audio_sr\": 0} or a negative value in a video request, typically while trying to disable audio handling.","commonSituations":"Users pass audio_sr=0 thinking it disables audio (audio_cap=0 is the correct switch), or forward a corrupted/unset config value.","solutions":["Keep audio_sr at its default 16000 unless the model card says otherwise","To disable audio, set audio_cap=0 (process_audio), not audio_sr=0","Ensure any dynamically built video_config keeps audio_sr a positive integer"],"exampleFix":"// before\nvideo_config = {\"audio_cap\": 0, \"audio_sr\": 0}\n// after\nvideo_config = {\"audio_cap\": 0, \"audio_sr\": 16000}","handlingStrategy":"validation","validationCode":"sr = cfg.get('audio_sr', 16000)\nassert isinstance(sr, int) and sr > 0, f'audio_sr must be positive, got {sr}'","typeGuard":"def valid_audio_sr(cfg: dict) -> bool:\n    sr = cfg.get('audio_sr', 16000)\n    return isinstance(sr, int) and sr > 0","tryCatchPattern":null,"preventionTips":["Use audio_cap=0 to disable audio, never audio_sr=0","Default 16000 works for this model family"],"tags":["multimodal","audio","sample-rate","valueerror"],"backgroundTag":"invalid-config-parameter","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}