sgl-project/sglang · error · ValueError

Kimi-K3 image processor is missing deferred-preprocessing co

Error message

Kimi-K3 image processor is missing deferred-preprocessing config: {missing}

What it means

Raised by prepare_kimi_k3_encoder_inputs when the model's media processor config (media_proc_cfg) is missing one or more required deferred-preprocessing keys (e.g. patch_size, patch_limit_on_one_side, image_mean, image_std). The Kimi-K3 pipeline defers image preprocessing to the encoder side, so these fields must be present in the processor config for the run to proceed.

Source

Thrown at python/sglang/srt/multimodal/kimi_k3_image_processing.py:72

            "image_processor.media_proc_cfg"
        ) from exc
    if not isinstance(media_proc_cfg, dict):
        raise ValueError(
            "Kimi-K3 EPD owner-side preprocessing requires "
            "image_processor.media_proc_cfg"
        )

    required = (
        "patch_size",
        "merge_kernel_size",
        "in_patch_limit",
        "patch_limit_on_one_side",
        "image_mean",
        "image_std",
    )
    missing = [name for name in required if name not in media_proc_cfg]
    if missing:
        raise ValueError(
            "Kimi-K3 image processor is missing deferred-preprocessing config: "
            + ", ".join(missing)
        )

    concrete_images = []
    content_digests = []
    for image in images:
        content_digest = None
        if isinstance(image, dict):
            if image.get("type") != "image" or "image" not in image:
                raise ValueError(f"Unsupported Kimi-K3 encoder media item: {image}")
            content_digest = image.get("content_hash")
            image = image["image"]
        concrete_images.append(image)
        content_digests.append(content_digest)

    patch_size = int(media_proc_cfg["patch_size"])
    merge_kernel_size = int(media_proc_cfg["merge_kernel_size"])

View on GitHub (pinned to 0132848349)

Solutions

  1. Check the error's missing list and add each named key to the model's preprocessor_config.json / media_proc_cfg
  2. Diff your processor config against the official Kimi-K3 repo config to restore any dropped fields
  3. If building cfg programmatically, populate all required keys from the HF image processor config before calling prepare_kimi_k3_encoder_inputs

Example fix

// before
cfg = {"patch_size": 16}
prepare_kimi_k3_encoder_inputs(images, cfg, ...)
// after
cfg = {"patch_size": 16, "patch_limit_on_one_side": True, "image_mean": [0.5]*3, "image_std": [0.5]*3}
prepare_kimi_k3_encoder_inputs(images, cfg, ...)
Defensive patterns

Strategy: validation

Validate before calling

REQUIRED = ("patch_size", "patch_limit_on_one_side", "image_mean", "image_std")
missing = [k for k in REQUIRED if k not in media_proc_cfg]
assert not missing, f"missing config keys: {missing}"

Prevention

When it happens

Trigger: Calling prepare_kimi_k3_encoder_inputs (directly or via preprocess_mm_for_encoder / model_preprocessor) with a media_proc_cfg dict that lacks any of the required keys: patch_size, patch_limit_on_one_side, image_mean, image_std (and others in the required tuple).

Common situations: Using a custom or trimmed Kimi-K3 processor config JSON that omitted preprocessing fields; upgrading the model repo where config keys were renamed; constructing media_proc_cfg manually in tests or offline pipelines.

Related errors


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