{"record":{"id":"6adc90f371da6d0b","repo":"sgl-project/sglang","slug":"kimi-expert-pack-range-mismatch-at-index-index","errorCode":null,"errorMessage":"Kimi expert-pack range mismatch at index {index}","messagePattern":"Kimi expert-pack range mismatch at index (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/layers/moe/expert_pack.py","lineNumber":845,"sourceCode":"                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]\n                )\n                if offset != expected_offset:\n                    raise ValueError(\n                        f\"Kimi expert object is not contiguous at index {index}\"\n                    )\n                generation_bytes = hashlib.sha256(\n                    f\"{pack_manifest['index_sha256']}:{layer}:{expert}\".encode(\"ascii\")\n                ).digest()\n                generation = int.from_bytes(generation_bytes[:8], \"little\") or 1\n                logical_role_id = ROLE_NAMES.index(physical_role)","sourceCodeStart":827,"sourceCodeEnd":863,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/moe/expert_pack.py#L827-L863","documentation":"An index entry's byte range is invalid: nbytes differs from the role's expected size, offset is not aligned to the manifest alignment, offset goes backwards (before previous entry's end), or offset+nbytes exceeds the file size. The data region must be a strictly increasing, aligned, in-bounds layout.","triggerScenarios":"Corrupted index after bit rot or bad writes; a pack written with different alignment or unsorted offsets; manifest alignment field inconsistent with actual data.","commonSituations":"See trigger scenarios.","solutions":["Verify file integrity (size, then SHA-256) and re-download if mismatched","Re-pack with consistent alignment; ensure offsets are emitted in increasing order and role sizes match expected_nbytes"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"null","typeGuard":null,"tryCatchPattern":"try:\n    pack = KimiExpertPack(path, manifest)\nexcept ValueError as e:\n    if 'range mismatch' in str(e):\n        log.error('pack data region corrupt; re-download')\n    raise","preventionTips":["Verify SHA-256 after download","Store packs on reliable storage; avoid in-place rewrites"],"tags":["kimi","moe","expert-pack","range-validation"],"backgroundTag":"corrupt-index-entry","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}