{"record":{"id":"1b4fc134c5f4b979","repo":"sgl-project/sglang","slug":"unsupported-kimi-k3-deferred-preprocessing-backend","errorCode":null,"errorMessage":"Unsupported Kimi-K3 deferred preprocessing backend: {backend}","messagePattern":"Unsupported Kimi-K3 deferred preprocessing backend: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/models/kimi_k3.py","lineNumber":3473,"sourceCode":"                            post_resize=lambda x: fill_transparent_bg(\n                                x, first_config.transparent_bg_config\n                            ),\n                        )\n                        expected_grids = grid_thws_host[global_indices]\n                        if not torch.equal(produced_grids.cpu(), expected_grids):\n                            raise ValueError(\n                                \"Kimi-K3 deferred GPU preprocessing produced wrong grids\"\n                            )\n                    elif backend == \"cpu\":\n                        from sglang.srt.multimodal.kimi_k3_image_processing import (\n                            materialize_kimi_k3_cpu_features,\n                        )\n\n                        pixel_values = materialize_kimi_k3_cpu_features(\n                            group_items, self._encoder_image_processor\n                        )\n                    else:\n                        raise ValueError(\n                            f\"Unsupported Kimi-K3 deferred preprocessing backend: {backend}\"\n                        )\n\n                    patch_counts = [\n                        int(grid_thws_host[index].prod().item())\n                        for index in global_indices\n                    ]\n                    if sum(patch_counts) != pixel_values.shape[0]:\n                        raise ValueError(\n                            \"Kimi-K3 deferred feature length does not match image grids\"\n                        )\n                    for index, feature in zip(\n                        indices, pixel_values.split(patch_counts), strict=True\n                    ):\n                        materialized[index] = feature\n\n                return materialize_multimodal_features(\n                    materialized,","sourceCodeStart":3455,"sourceCodeEnd":3491,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/kimi_k3.py#L3455-L3491","documentation":"materialize_item_features() dispatches deferred preprocessing only to 'gpu' and 'cpu' backends; any other value in the deferred config's backend field raises ValueError. The backend string comes from the per-item deferred preprocessing config.","triggerScenarios":"A deferred config with backend set to something other than 'gpu' or 'cpu' (typo, renamed constant, or new unsupported backend) reaching the dispatch in get_image_feature().","commonSituations":"Custom preprocessing configs introduced by a fork or newer config format; enum/constant renamed between versions so the stored backend string no longer matches.","solutions":["Set backend to 'gpu' or 'cpu' explicitly in the deferred preprocessing config","Validate backend values at config construction time against {'gpu','cpu'}","Sync any fork-specific backend names with upstream constants"],"exampleFix":"// before\ncfg.backend = \"cuda\"  # unsupported\n\n// after\ncfg.backend = \"gpu\"","handlingStrategy":"validation","validationCode":"assert cfg.backend in {\"gpu\", \"cpu\"}, f\"unsupported backend {cfg.backend}\"","typeGuard":"def is_supported_backend(b) -> bool:\n    return b in {\"gpu\", \"cpu\"}","tryCatchPattern":"try:\n    model.get_image_feature(items)\nexcept ValueError as e:\n    if \"backend\" in str(e):\n        cfg.backend = \"cpu\"\n        return model.get_image_feature(items)\n    raise","preventionTips":["Construct deferred configs from constants, not raw strings","Validate backend at config creation and fail early with a clear message"],"tags":["kimi-k3","preprocessing-backend","unsupported-value"],"backgroundTag":"unsupported-backend-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}