sgl-project/sglang · error · ValueError
MiniMax H3 task must be a non-empty string
Error message
MiniMax H3 task must be a non-empty string
What it means
partition_for_task validates its task argument: it must be a Python str (not None or another type) and must contain non-whitespace content. This is the first gate before task normalization and partition lookup, so non-string or blank inputs fail fast with a clear message.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/task_profiles.py:51
{
"t2va": "fl2va",
"fl2va": "fl2va",
"ref2va": "ref2va",
}
)
def canonical_minimax_h3_task(task: str) -> str:
"""Normalize a public task name (no aliases are currently defined)."""
return task
def partition_for_task(task: str) -> str:
"""Return the deployment partition serving *task*."""
if not isinstance(task, str) or not task.strip():
raise ValueError("MiniMax H3 task must be a non-empty string")
normalized = task.strip().lower()
try:
return MINIMAX_H3_TASK_PARTITIONS[normalized]
except KeyError as exc:
raise ValueError(f"unsupported MiniMax H3 task {task!r}") from exc
MINIMAX_H3_FINITE_ASPECT_RATIOS = (
"21:9",
"16:9",
"4:3",
"1:1",
"3:4",
"9:16",
)
# ``fl2va`` remains the single public task name for all keyframe variants:
# first-frame-only, last-frame-only, and first+last. Keep the acceptedView on GitHub (pinned to 0132848349)
Solutions
- Set a valid task string (e.g. 't2va', 'fl2va', 'ref2va') in your config/request
- Default the field explicitly instead of leaving it None
- Strip/validate user input before passing it to partition_for_task
Example fix
# before
task = config.get("task")
partition = partition_for_task(task)
# after
task = (config.get("task") or "").strip().lower()
if not task:
raise ValueError("config must set 'task'")
partition = partition_for_task(task) Defensive patterns
Strategy: validation
Validate before calling
task = (raw_task or "").strip() if isinstance(raw_task, str) else ""
if not task:
raise ValueError("'task' must be a non-empty string")
partition = partition_for_task(task) Type guard
def is_nonempty_task(task: Any) -> bool:
return isinstance(task, str) and bool(task.strip()) Try / catch
catch ValueError around partition_for_task and map it to a 400-level config error
Prevention
- Make 'task' a required field in config schemas
- Normalize task input at the API boundary
When it happens
Trigger: Calling partition_for_task(None), partition_for_task(''), partition_for_task(' '), or passing an int/dict instead of a string. Also hit when the task comes from an unvalidated config field that defaults to None.
Common situations: Reading task from CLI args or YAML config where it was omitted; a caller passing task.get('task') on a dict without the key; API requests missing the task field.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- ref2va keyframes require at least one reference condition; u
- task {plan.task!r} cannot carry image.target_canvas material
- unsupported MiniMax H3 task {task!r}
- MiniMax H3 shift_scale must be > 0
- MiniMax H3 num_steps must be > 0
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/009749e9d3bcc116.
Report an issue: GitHub.