sgl-project/sglang · error · ValueError

quality must be one of {list(QUALITY_LEVELS)}, got {quality!

Error message

quality must be one of {list(QUALITY_LEVELS)}, got {quality!r}

What it means

The admission stage validates the optional sampling_params.quality attribute (defaulting to "lossless") against QUALITY_LEVELS. Any value outside that set (e.g. "medium", "ultra") is rejected before planning.

Source

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

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'
                )
            shape = plan.shape
            actual = {
                "task": plan.task,
                "width": int(shape["width"]),
                "height": int(shape["height"]),
                "fps": int(shape["fps"]),
                "frame_count": int(shape["frame_count"]),
                "num_inference_steps": int(batch.num_inference_steps),

View on GitHub (pinned to 0132848349)

Solutions

  1. Use one of the values in QUALITY_LEVELS, e.g. "lossless" or "high"
  2. Omit quality entirely to get the "lossless" default
  3. Check QUALITY_LEVELS in this module for the exact accepted spelling

Example fix

# before
sampling_params.quality = "medium"
# after
sampling_params.quality = "high"  # or omit for "lossless"
Defensive patterns

Strategy: validation

Validate before calling

from ... import QUALITY_LEVELS
q = getattr(sampling_params, "quality", "lossless")
if q not in QUALITY_LEVELS:
    reject(f"quality must be one of {QUALITY_LEVELS}")

Type guard

def quality_ok(sp) -> bool:
    return getattr(sp, "quality", "lossless") in QUALITY_LEVELS

Prevention

When it happens

Trigger: Setting sampling_params.quality to a string not in QUALITY_LEVELS (typically only "lossless" and "high") on a MiniMax H3 request.

Common situations: Clients porting quality knobs from other models ("standard"/"fast"), or typos like "High" with capitalization.

Related errors


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