sgl-project/sglang · error · RuntimeError

MiniMax H3 video generation produced {len(output_paths)} out

Error message

MiniMax H3 video generation produced {len(output_paths)} output files, expected {expected_outputs}

What it means

After MiniMax H3 generation, the adapter validates that the number of produced output files equals batch.num_outputs_per_prompt (the requested N variations per prompt). A mismatch means generation produced fewer/more files than requested — typically a backend/scheduler bug or truncated generation, so it raises RuntimeError.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/video_adapter.py:319

        queued_frame_count = shape.get("frame_count")
        if queued_frame_count is not None:
            fields["seconds"] = _format_video_seconds(
                int(queued_frame_count) / float(shape["fps"])
            )
        quality = getattr(batch.sampling_params, "quality", None)
        explicit_fields = getattr(batch.sampling_params, "_explicit_fields", ())
        if quality and "quality" in explicit_fields:
            fields["quality"] = str(quality)
        return fields

    def validate_final_outputs_sync(
        self,
        output_paths: list[str],
        batch: Req,
    ) -> dict[str, str]:
        expected_outputs = int(getattr(batch, "num_outputs_per_prompt", 1))
        if len(output_paths) != expected_outputs:
            raise RuntimeError(
                "MiniMax H3 video generation produced "
                f"{len(output_paths)} output files, expected {expected_outputs}"
            )

        expected_frame_count = None
        expected_size = None
        shape = self._resolved_shape(batch)
        if shape is not None:
            if shape.get("frame_count") is not None:
                expected_frame_count = int(shape["frame_count"])
            if shape.get("width") is not None and shape.get("height") is not None:
                expected_size = (int(shape["width"]), int(shape["height"]))

        def probe_output(output_path: str) -> dict[str, str]:
            return _probe_minimax_h3_output_fields(
                output_path,
                expected_frame_count=expected_frame_count,
                expected_size=expected_size,

View on GitHub (pinned to 0132848349)

Solutions

  1. Retry the request; check scheduler logs for per-output failures
  2. Verify output_path directory is writable and not full
  3. Set num_outputs_per_prompt=1 to isolate whether multi-output handling is the issue
  4. Report as a bug if reproducible with a single output request
Defensive patterns

Strategy: retry

Validate before calling

expected = int(getattr(batch, "num_outputs_per_prompt", 1))
assert expected >= 1  # sanity before submitting

Try / catch

try:
    result = adapter.validate_final_outputs_sync(paths, batch)
except RuntimeError as e:
    if "expected" in str(e):
        paths = regenerate_with_retry(prompt, n=expected)
    else:
        raise

Prevention

When it happens

Trigger: validate_final_outputs_sync runs with len(output_paths) != num_outputs_per_prompt, e.g. requesting n=4 outputs but only 1 MP4 written, or duplicated files when n=1.

Common situations: Multi-sample generation (num_outputs_per_prompt>1) with partial failures; disk-full silently dropping writes; scheduler bugs losing some outputs.

Related errors


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