sgl-project/sglang · error · ValueError
prompt must be non-empty
Error message
prompt must be non-empty
What it means
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.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/presentation.py:112
counts = [int(value) for value in counts]
timestamps = [float(value) for value in timestamps]
if not counts or len(counts) != len(timestamps):
raise ValueError(f"{context}video block token counts and timestamps must align")
for count, timestamp in zip(counts, timestamps):
if count <= 0:
raise ValueError(f"{context}video block token count must be positive")
presentation.text(_text_ids(tokenizer, f"<{timestamp:.1f} seconds>"))
presentation.vision(
_vision_block_ids(tokenizer, VIDEO_PAD, count),
video_token_id=video_token_id,
)
def minimax_h3_text_only_ids(tokenizer: Any, prompt: str) -> torch.Tensor:
"""t2va presentation: verbatim prompt, no special tokens."""
if not prompt:
raise ValueError("prompt must be non-empty")
return torch.tensor(_text_ids(tokenizer, prompt), dtype=torch.long)
def minimax_h3_multi_image_presentation(
tokenizer: Any,
*,
prompt: str,
image_token_counts: list[int],
) -> tuple[torch.Tensor, torch.Tensor]:
if not image_token_counts:
raise ValueError("image_token_counts must be non-empty")
presentation = _Presentation()
for index, count in enumerate(image_token_counts, start=1):
if int(count) <= 0:
raise ValueError("image_token_count must be positive")
presentation.text(_text_ids(tokenizer, f"<Picture {index}>: "))
presentation.vision(_vision_block_ids(tokenizer, IMAGE_PAD, count))
presentation.text(_text_ids(tokenizer, prompt))View on GitHub (pinned to 0132848349)
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
Example fix
// before
ids = minimax_h3_text_only_ids(tokenizer, prompt)
// after
if not prompt:
raise ValueError("caption required")
ids = minimax_h3_text_only_ids(tokenizer, prompt) Defensive patterns
Strategy: validation
Validate before calling
if not prompt or not prompt.strip():
raise ValueError("prompt required for text-only encoding") Type guard
def has_prompt(p: str | None) -> bool:
return bool(p and p.strip()) Prevention
- Validate prompt truthiness at request ingress
- Provide default captions for empty user input
When it happens
Trigger: Calling minimax_h3_text_only_ids(tokenizer, "") or with a whitespace-only/None-coerced prompt.
Common situations: Prompt templates where a user variable is empty; optional prompt fields defaulting to ""; data pipelines forwarding missing captions.
Related errors
- MiniMax-H3 adaln_t_table must have shape [N, D] with N >= 2,
- MiniMax H3 AdaLN cache has invalid timestep plans
- TP size must be positive.
- num_attention_heads must be positive.
- hidden_size must be positive.
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/90ed2728db30edf8.
Report an issue: GitHub.