{"record":{"id":"96327a3a77a39034","repo":"sgl-project/sglang","slug":"kimi-k3-manifest-format-is-unsupported","errorCode":null,"errorMessage":"Kimi-K3 manifest format is unsupported","messagePattern":"Kimi-K3 manifest format is unsupported","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/model_loader/kimi_k3_gguf.py","lineNumber":148,"sourceCode":"    \"\"\"Undo llama.cpp's GGUF-time ``A_log -> -exp(A_log)`` transform.\"\"\"\n    if not raw.is_floating_point() or not torch.isfinite(raw).all():\n        raise ValueError(\"Kimi-K3 GGUF ssm_a must contain finite floating values\")\n    if not torch.all(raw < 0):\n        raise ValueError(\"Kimi-K3 GGUF ssm_a must contain only -exp(A_log) values\")\n    return torch.log(-raw)\n\n\ndef kimi_k3_nonexpert_weights_iterator(\n    manifest_path: str | os.PathLike[str],\n) -> Generator[tuple[str, torch.Tensor], None, None]:\n    \"\"\"Stream non-routed tensors shard by shard without reading routed payloads.\"\"\"\n\n    import gguf\n\n    manifest_file = Path(manifest_path).resolve()\n    manifest = json.loads(manifest_file.read_text(encoding=\"utf-8\"))\n    if manifest.get(\"format\") != \"SGLANG-KIMI-GGMLMOEPACK-ADAPTER-v1\":\n        raise ValueError(\"Kimi-K3 manifest format is unsupported\")\n    if not manifest.get(\"complete\"):\n        raise ValueError(\"Kimi-K3 manifest is incomplete\")\n\n    records_by_shard: dict[int, list[dict]] = defaultdict(list)\n    for record in manifest[\"source\"][\"tensors\"]:\n        records_by_shard[int(record[\"shard_index\"])].append(record)\n\n    emitted: set[str] = set()\n    for shard in manifest[\"source\"][\"shards\"]:\n        shard_index = int(shard[\"index\"])\n        shard_path = Path(shard[\"path\"]).resolve()\n        if not shard_path.is_file() or shard_path.stat().st_size != int(shard[\"size\"]):\n            raise FileNotFoundError(\n                f\"Kimi-K3 GGUF shard is missing or changed: {shard_path}\"\n            )\n        reader = gguf.GGUFReader(str(shard_path), mode=\"r\")\n        tensors = {tensor.name: tensor for tensor in reader.tensors}\n        expected = {record[\"name\"]: record for record in records_by_shard[shard_index]}","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/model_loader/kimi_k3_gguf.py#L130-L166","documentation":"The manifest JSON passed to kimi_k3_nonexpert_weights_iterator must declare format == 'SGLANG-KIMI-GGMLMOEPACK-ADAPTER-v1'. Any other or missing format string raises this error, guarding against feeding an arbitrary GGUF/manifest to the Kimi-K3 adapter loader.","triggerScenarios":"Passing a manifest_path whose JSON lacks the exact format field value — e.g. a vanilla GGUF conversion manifest, a different adapter version, or a typo'd hand-written manifest.","commonSituations":"Version mismatch between the conversion tool that produced the manifest and the sglang loader; user points --model at a plain GGUF without running the SGLang adapter packing step.","solutions":["Re-run the SGLang Kimi-K3 GGMLMoEPack adapter conversion tool to produce a v1 manifest.","Check the manifest's format field and, if the converter is newer/older, align converter and sglang versions.","If the manifest was hand-edited, restore format to SGLANG-KIMI-GGMLMOEPACK-ADAPTER-v1 only if the content genuinely matches v1."],"exampleFix":"// before\n{\"format\": \"GGUF\", ...}\n// after\n{\"format\": \"SGLANG-KIMI-GGMLMOEPACK-ADAPTER-v1\", \"complete\": true, ...}","handlingStrategy":"validation","validationCode":"import json, pathlib\nm = json.loads(pathlib.Path(manifest_path).read_text())\nassert m.get(\"format\") == \"SGLANG-KIMI-GGMLMOEPACK-ADAPTER-v1\", f\"unsupported format {m.get('format')}\"","typeGuard":"def is_supported_manifest(m: dict) -> bool:\n    return isinstance(m, dict) and m.get(\"format\") == \"SGLANG-KIMI-GGMLMOEPACK-ADAPTER-v1\"","tryCatchPattern":null,"preventionTips":["Only load manifests produced by the matching sglang Kimi-K3 packer version.","Check the format field in tooling before invoking load_model."],"tags":["kimi-k3","gguf","manifest","version-mismatch"],"backgroundTag":"unsupported-manifest-format","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}