sgl-project/sglang · error · ValueError

MiniMax H3 image material has no positive display geometry

Error message

MiniMax H3 image material has no positive display geometry

What it means

The decoded image (after EXIF orientation transpose) has width or height <= 0. Only possible for degenerate or malformed images that PIL tolerates during decode but reports no real geometry for.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/material_io.py:381

    """

    if condition_type == "image":
        try:
            from PIL import Image, ImageOps

            with Image.open(path) as image:
                coded_width, coded_height = image.size
                image_format = str(image.format or "").upper()
                if coded_width <= 0 or coded_height <= 0:
                    raise ValueError("image has no positive dimensions")
                display_image = ImageOps.exif_transpose(image)
                width, height = display_image.size
        except Exception as exc:
            raise ValueError("MiniMax H3 image material is invalid") from exc
        if image_format not in {"JPEG", "PNG", "WEBP"}:
            raise ValueError("MiniMax H3 image material uses an unsupported format")
        if width <= 0 or height <= 0:
            raise ValueError(
                "MiniMax H3 image material has no positive display geometry"
            )
        return {
            "condition_type": "image",
            "coded_width": int(coded_width),
            "coded_height": int(coded_height),
            "display_width": int(width),
            "display_height": int(height),
            "image_format": image_format,
            "exif_transposed": (coded_width, coded_height) != (width, height),
        }

    if condition_type not in {"audio", "video", "video_audio"}:
        raise ValueError(f"unsupported MiniMax H3 condition type {condition_type!r}")
    try:
        payload = _ffprobe_media(path)
    except Exception as exc:
        raise ValueError("MiniMax H3 media material is invalid") from exc

View on GitHub (pinned to 0132848349)

Solutions

  1. Re-encode the image through a real tool (PIL/Pillow re-save or ImageMagick)
  2. Reject the material at ingest with your own dimension check
  3. If recurring, identify the producer creating degenerate images
Defensive patterns

Strategy: validation

Validate before calling

from PIL import Image, ImageOps
with Image.open(path) as im:
    w, h = ImageOps.exif_transpose(im).size
    assert w > 0 and h > 0

Prevention

When it happens

Trigger: Pathological image files where ImageOps.exif_transpose(image).size returns a zero dimension — crafted/corrupt files or exotic encoder output.

Common situations: Fuzzed/adversarial inputs, images produced by broken encoders, or zero-pixel placeholder images.

Related errors


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