{"record":{"id":"90ed2728db30edf8","repo":"sgl-project/sglang","slug":"prompt-must-be-non-empty","errorCode":null,"errorMessage":"prompt must be non-empty","messagePattern":"prompt must be non-empty","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/presentation.py","lineNumber":112,"sourceCode":"\n    counts = [int(value) for value in counts]\n    timestamps = [float(value) for value in timestamps]\n    if not counts or len(counts) != len(timestamps):\n        raise ValueError(f\"{context}video block token counts and timestamps must align\")\n    for count, timestamp in zip(counts, timestamps):\n        if count <= 0:\n            raise ValueError(f\"{context}video block token count must be positive\")\n        presentation.text(_text_ids(tokenizer, f\"<{timestamp:.1f} seconds>\"))\n        presentation.vision(\n            _vision_block_ids(tokenizer, VIDEO_PAD, count),\n            video_token_id=video_token_id,\n        )\n\n\ndef minimax_h3_text_only_ids(tokenizer: Any, prompt: str) -> torch.Tensor:\n    \"\"\"t2va presentation: verbatim prompt, no special tokens.\"\"\"\n    if not prompt:\n        raise ValueError(\"prompt must be non-empty\")\n    return torch.tensor(_text_ids(tokenizer, prompt), dtype=torch.long)\n\n\ndef minimax_h3_multi_image_presentation(\n    tokenizer: Any,\n    *,\n    prompt: str,\n    image_token_counts: list[int],\n) -> tuple[torch.Tensor, torch.Tensor]:\n    if not image_token_counts:\n        raise ValueError(\"image_token_counts must be non-empty\")\n    presentation = _Presentation()\n    for index, count in enumerate(image_token_counts, start=1):\n        if int(count) <= 0:\n            raise ValueError(\"image_token_count must be positive\")\n        presentation.text(_text_ids(tokenizer, f\"<Picture {index}>: \"))\n        presentation.vision(_vision_block_ids(tokenizer, IMAGE_PAD, count))\n    presentation.text(_text_ids(tokenizer, prompt))","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/presentation.py#L94-L130","documentation":"minimax_h3_text_only_ids encodes a plain prompt for the t2va (text-to-video-audio) path and requires it non-empty; an empty string would produce an empty token tensor with no text conditioning.","triggerScenarios":"Calling minimax_h3_text_only_ids(tokenizer, \"\") or with a whitespace-only/None-coerced prompt.","commonSituations":"Prompt templates where a user variable is empty; optional prompt fields defaulting to \"\"; data pipelines forwarding missing captions.","solutions":["Validate/skip empty prompts upstream","Provide a fallback prompt string (e.g. a default caption) before encoding","Strip and check prompt truthiness before calling"],"exampleFix":"// before\nids = minimax_h3_text_only_ids(tokenizer, prompt)\n// after\nif not prompt:\n    raise ValueError(\"caption required\")\nids = minimax_h3_text_only_ids(tokenizer, prompt)","handlingStrategy":"validation","validationCode":"if not prompt or not prompt.strip():\n    raise ValueError(\"prompt required for text-only encoding\")","typeGuard":"def has_prompt(p: str | None) -> bool:\n    return bool(p and p.strip())","tryCatchPattern":null,"preventionTips":["Validate prompt truthiness at request ingress","Provide default captions for empty user input"],"tags":["minimax-h3","text-encoding","validation"],"backgroundTag":"empty-input-validation","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}