{"record":{"id":"6546d31ffa73cdc8","repo":"sgl-project/sglang","slug":"k-mode-must-not-be-empty","errorCode":null,"errorMessage":"k_mode must not be empty","messagePattern":"k_mode must not be empty","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/dots_note_omni.py","lineNumber":136,"sourceCode":"    if last < len(user_value):\n        content.append({\"type\": \"text\", \"text\": user_value[last:]})\n    return content\n\n\ndef preprocess_dots_video(\n    raw_video,\n    question: str,\n    *,\n    tokenizer,\n    seq: int = 131072,\n    audio_cap: float = 1.0,\n    audio_sr: int = 16000,\n    k_mode: str = \"eval_ek\",\n    max_new_tokens: int = 0,\n) -> list[dict[str, Any]]:\n    \"\"\"Return in-memory timestamp/image/audio content using the server tokenizer.\"\"\"\n    if not k_mode:\n        raise ValueError(\"k_mode must not be empty\")\n    video_bytes, video_id = _video_payload(raw_video)\n    cfg = _build_video_cfg(\n        seq=seq,\n        audio_cap=audio_cap,\n        audio_sr=audio_sr,\n        max_new_tokens=max_new_tokens,\n    )\n    from sglang.srt.multimodal.processors.dots_note_omni_video_core import (\n        flatten_runner,\n    )\n    from sglang.srt.multimodal.processors.dots_note_omni_video_core import (\n        preprocess as pp,\n    )\n\n    video_b64 = base64.b64encode(video_bytes).decode()\n    sample = {\n        \"meta\": {\"video_0\": video_b64},\n        \"conversations\": [{\"from\": \"user\", \"value\": f\"<video_0>{question}\"}],","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/dots_note_omni.py#L118-L154","documentation":"Raised by preprocess_dots_video when k_mode is an empty string. k_mode selects the model's key/mode preset for video preprocessing (default 'eval_ek') and cannot be blank.","triggerScenarios":"Passing video_config={\"k_mode\": \"\"} (explicitly empty) in a video request; None falls back to the default, only '' fails the falsy check.","commonSituations":"Config templating code injects an empty string for an unset key (e.g. k_mode from an env var or YAML field left blank) instead of omitting it.","solutions":["Omit k_mode from video_config to use the default 'eval_ek'","Or set a valid mode string such as 'eval_ek'","Sanitize config dicts to drop empty-string values before sending"],"exampleFix":"// before\nvideo_config = {\"k_mode\": k_mode or \"\"}\n// after\nvideo_config = {\"k_mode\": k_mode} if k_mode else {}","handlingStrategy":"validation","validationCode":"cfg = {k: v for k, v in cfg.items() if v != ''}  # drop empty strings\nif 'k_mode' in cfg:\n    assert cfg['k_mode'], 'k_mode must be a non-empty string'","typeGuard":"def valid_k_mode(cfg: dict) -> bool:\n    km = cfg.get('k_mode', 'eval_ek')\n    return isinstance(km, str) and len(km) > 0","tryCatchPattern":null,"preventionTips":["Omit optional keys instead of sending empty strings","Sanitize templated config dicts for blank values"],"tags":["multimodal","video","config-validation","valueerror"],"backgroundTag":"invalid-config-parameter","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}