{"record":{"id":"7b5fb3f72b016592","repo":"sgl-project/sglang","slug":"kimi-expert-pack-identity-mismatch-at-index-index","errorCode":null,"errorMessage":"Kimi expert-pack identity mismatch at index {index}","messagePattern":"Kimi expert-pack identity mismatch at index (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/layers/moe/expert_pack.py","lineNumber":835,"sourceCode":"                    raise ValueError(\"Kimi expert-pack index is truncated\")\n                index_digest.update(raw_entry)\n                name_raw, expert, reserved, offset, nbytes = GGML_PACK_ENTRY.unpack(\n                    raw_entry\n                )\n                object_index, physical_role_id = divmod(index, len(KIMI_PHYSICAL_ROLES))\n                layer_index, expected_expert = divmod(object_index, expected_experts)\n                layer = active_layers[layer_index]\n                physical_role = KIMI_PHYSICAL_ROLES[physical_role_id]\n                name = _fixed_string(name_raw)\n                match = KIMI_EXPERT_RE.fullmatch(name)\n                if (\n                    match is None\n                    or int(match.group(\"layer\")) != layer\n                    or match.group(\"role\") != physical_role\n                    or expert != expected_expert\n                    or reserved != 0\n                ):\n                    raise ValueError(\n                        f\"Kimi expert-pack identity mismatch at index {index}\"\n                    )\n                expected_nbytes = role_nbytes[physical_role]\n                if (\n                    nbytes != expected_nbytes\n                    or offset % int(pack_manifest[\"alignment\"])\n                    or offset < previous_end\n                    or offset + nbytes > self.path.stat().st_size\n                ):\n                    raise ValueError(\n                        f\"Kimi expert-pack range mismatch at index {index}\"\n                    )\n                previous_end = offset + nbytes\n                object_key = (layer, expert)\n                if physical_role_id == 0:\n                    self.object_offsets[object_key] = offset\n                expected_offset = (\n                    self.object_offsets[object_key] + role_offsets[physical_role]","sourceCodeStart":817,"sourceCodeEnd":853,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/moe/expert_pack.py#L817-L853","documentation":"Index entry fields don't match the derived identity: the entry name must parse as layer/role, expert must equal the derived expected expert for the position, and reserved must be 0. This is a structural integrity check that entries appear in the exact canonical order.","triggerScenarios":"Entries shuffled or renamed (non-canonical ordering), a reserved field set nonzero by a foreign writer, or a pack from a tool that names entries differently.","commonSituations":"See trigger scenarios.","solutions":["Re-pack with the official tool so entries are written in canonical layer-major, role-minor order with correct names","If writing your own packer, emit name f-strings matching layer/role, expert = index-derived value, reserved = 0"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    pack = KimiExpertPack(path, manifest)\nexcept ValueError as e:\n    if 'identity mismatch' in str(e):\n        log.error('pack index entries out of canonical order; re-pack needed')\n    raise","preventionTips":["Only use unmodified official packs","Verify full SHA-256 before loading to catch any corruption early"],"tags":["kimi","moe","expert-pack","index-integrity"],"backgroundTag":"corrupt-index-entry","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}