sgl-project/sglang · error · ValueError

MiniMax H3 request task must be a non-empty string

Error message

MiniMax H3 request task must be a non-empty string

What it means

MiniMaxH3PartitionAdmissionStage.forward requires every request to carry a non-empty string task in sampling_params. A missing sampling_params (task defaults None), a non-string, or a whitespace-only string raises immediately.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/release_metadata.py:148

                f"task {task!r} is not served by MiniMax H3 partition {self.partition!r}; "
                f"supported tasks: {list(self.tasks)!r}"
            )
        if partition_for_task(canonical) != self.partition:
            raise ValueError(
                f"task {task!r} resolves outside partition {self.partition!r}"
            )
        return canonical


class MiniMaxH3PartitionAdmissionStage(PipelineStage):
    def __init__(self, metadata: MiniMaxH3ReleaseMetadata) -> None:
        super().__init__()
        self.metadata = metadata

    def forward(self, batch: Req, server_args: ServerArgs) -> Req:
        task = None if batch.sampling_params is None else batch.sampling_params.task
        if not isinstance(task, str) or not task.strip():
            raise ValueError("MiniMax H3 request task must be a non-empty string")
        self.metadata.canonical_task(task)
        if batch.num_inference_steps < 2:
            raise ValueError(
                "MiniMax H3 requires num_inference_steps >= 2 because its "
                "video/audio sigma schedules include both interval endpoints"
            )
        quality = getattr(batch.sampling_params, "quality", "lossless")
        if quality not in QUALITY_LEVELS:
            raise ValueError(
                f"quality must be one of {list(QUALITY_LEVELS)}, got {quality!r}"
            )
        high_quality = quality == "high"
        if high_quality and not batch.is_warmup:
            server_args.pipeline_config.validate_quality_deployment(server_args)
            plan = minimax_h3_plan_from_batch(batch)
            if plan is None:
                raise ValueError(
                    'MiniMax-H3 quality="high" requires a resolved request plan'

View on GitHub (pinned to 0132848349)

Solutions

  1. Set sampling_params.task to a valid MiniMax H3 task string (e.g. its canonical name or alias)
  2. Ensure request construction always populates task before enqueueing to this pipeline
  3. Catch and reject task-less requests upstream at the API layer with a 400

Example fix

# before
req.sampling_params.task = None
# after
req.sampling_params.task = "text_to_video"
Defensive patterns

Strategy: type-guard

Validate before calling

task = req.sampling_params.task if req.sampling_params else None
if not isinstance(task, str) or not task.strip():
    reject("task is required")

Type guard

def has_valid_task(req) -> bool:
    t = None if req.sampling_params is None else req.sampling_params.task
    return isinstance(t, str) and bool(t.strip())

Prevention

When it happens

Trigger: Sending a Req whose sampling_params is None, or sampling_params.task is None/int/""/" " through a pipeline containing this admission stage.

Common situations: Clients omitting the task field, warmup/dummy requests built without task, or generic text-only requests routed into the multimodal pipeline.

Understand the failure class

Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/ef805c512de74104. Report an issue: GitHub.