{"record":{"id":"ab6f1d63a34a84e8","repo":"sgl-project/sglang","slug":"kimi-expert-pack-role-sizes-do-not-match-object-by","errorCode":null,"errorMessage":"Kimi expert-pack role sizes do not match object bytes","messagePattern":"Kimi expert-pack role sizes do not match object bytes","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/layers/moe/expert_pack.py","lineNumber":795,"sourceCode":"            ):\n                raise ValueError(f\"Kimi expert-pack {role} quant type is unsupported\")\n\n        expected_entry_count = len(active_layers) * expected_experts * len(ROLE_NAMES)\n        index_digest = hashlib.sha256()\n        self.entries: dict[tuple[int, int, int], ExpertPackEntry] = {}\n        self.object_offsets: dict[tuple[int, int], int] = {}\n        object_payload_bytes = int(pack_manifest[\"object_bytes\"])\n        previous_end = int(pack_manifest[\"data_start\"])\n        role_offsets: dict[str, int] = {}\n        role_nbytes = {\n            role: int(roles[role][\"expert_bytes\"]) for role in KIMI_PHYSICAL_ROLES\n        }\n        running_role_offset = 0\n        for role in KIMI_PHYSICAL_ROLES:\n            role_offsets[role] = running_role_offset\n            running_role_offset += role_nbytes[role]\n        if running_role_offset != object_payload_bytes:\n            raise ValueError(\"Kimi expert-pack role sizes do not match object bytes\")\n\n        with self.path.open(\"rb\", buffering=0) as stream:\n            raw_header = stream.read(GGML_PACK_HEADER.size)\n            if len(raw_header) != GGML_PACK_HEADER.size:\n                raise ValueError(\"Kimi expert-pack header is truncated\")\n            index_digest.update(raw_header)\n            magic, version, header_size, index_count, data_start = (\n                GGML_PACK_HEADER.unpack(raw_header)\n            )\n            if (\n                magic != GGML_PACK_MAGIC\n                or version != 1\n                or header_size != GGML_PACK_HEADER.size\n                or index_count != expected_entry_count\n                or data_start != int(pack_manifest[\"data_start\"])\n            ):\n                raise ValueError(\"Kimi expert-pack header does not match its manifest\")\n","sourceCodeStart":777,"sourceCodeEnd":813,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/moe/expert_pack.py#L777-L813","documentation":"The sum of per-role byte sizes (role_nbytes summed over KIMI_PHYSICAL_ROLES) does not equal the manifest's expert_pack.object_bytes. This means the declared per-tensor sizes are internally inconsistent with the declared payload size, indicating a corrupt or miscomputed manifest.","triggerScenarios":"Manifest where role sizes were edited or computed with wrong shard counts (experts, hidden dims, quant block sizes) so their sum diverges from object_bytes.","commonSituations":"See trigger scenarios.","solutions":["Regenerate the manifest with the official packing tool so role sizes and object_bytes are computed consistently","Check that num_experts, intermediate size, and quant block-size math used to compute role_nbytes match the actual pack"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"total = sum(role_nbytes[r] for r in KIMI_PHYSICAL_ROLES)\nassert total == int(manifest['expert_pack']['object_bytes'])","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never edit role size fields in the manifest","Regenerate manifests with the packing tool after any change"],"tags":["kimi","moe","expert-pack","size-consistency"],"backgroundTag":"manifest-schema-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}