{"record":{"id":"6d06bfc1af8b1514","repo":"sgl-project/sglang","slug":"kimi-k3-image-processor-is-missing-deferred-prepro","errorCode":null,"errorMessage":"Kimi-K3 image processor is missing deferred-preprocessing config: {missing}","messagePattern":"Kimi-K3 image processor is missing deferred-preprocessing config: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/kimi_k3_image_processing.py","lineNumber":72,"sourceCode":"            \"image_processor.media_proc_cfg\"\n        ) from exc\n    if not isinstance(media_proc_cfg, dict):\n        raise ValueError(\n            \"Kimi-K3 EPD owner-side preprocessing requires \"\n            \"image_processor.media_proc_cfg\"\n        )\n\n    required = (\n        \"patch_size\",\n        \"merge_kernel_size\",\n        \"in_patch_limit\",\n        \"patch_limit_on_one_side\",\n        \"image_mean\",\n        \"image_std\",\n    )\n    missing = [name for name in required if name not in media_proc_cfg]\n    if missing:\n        raise ValueError(\n            \"Kimi-K3 image processor is missing deferred-preprocessing config: \"\n            + \", \".join(missing)\n        )\n\n    concrete_images = []\n    content_digests = []\n    for image in images:\n        content_digest = None\n        if isinstance(image, dict):\n            if image.get(\"type\") != \"image\" or \"image\" not in image:\n                raise ValueError(f\"Unsupported Kimi-K3 encoder media item: {image}\")\n            content_digest = image.get(\"content_hash\")\n            image = image[\"image\"]\n        concrete_images.append(image)\n        content_digests.append(content_digest)\n\n    patch_size = int(media_proc_cfg[\"patch_size\"])\n    merge_kernel_size = int(media_proc_cfg[\"merge_kernel_size\"])","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/kimi_k3_image_processing.py#L54-L90","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check the error's missing list and add each named key to the model's preprocessor_config.json / media_proc_cfg","Diff your processor config against the official Kimi-K3 repo config to restore any dropped fields","If building cfg programmatically, populate all required keys from the HF image processor config before calling prepare_kimi_k3_encoder_inputs"],"exampleFix":"// before\ncfg = {\"patch_size\": 16}\nprepare_kimi_k3_encoder_inputs(images, cfg, ...)\n// after\ncfg = {\"patch_size\": 16, \"patch_limit_on_one_side\": True, \"image_mean\": [0.5]*3, \"image_std\": [0.5]*3}\nprepare_kimi_k3_encoder_inputs(images, cfg, ...)","handlingStrategy":"validation","validationCode":"REQUIRED = (\"patch_size\", \"patch_limit_on_one_side\", \"image_mean\", \"image_std\")\nmissing = [k for k in REQUIRED if k not in media_proc_cfg]\nassert not missing, f\"missing config keys: {missing}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate required config keys right after loading the processor config at startup","Keep processor configs in sync with the official Kimi-K3 repo; diff after model upgrades"],"tags":["multimodal","kimi-k3","config-validation","preprocessing"],"backgroundTag":"missing-config-key","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}