sgl-project/sglang · critical · ValueError
Kimi expert-pack identity mismatch at index {index}
Error message
Kimi expert-pack identity mismatch at index {index} What it means
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.
Source
Thrown at python/sglang/srt/layers/moe/expert_pack.py:835
raise ValueError("Kimi expert-pack index is truncated")
index_digest.update(raw_entry)
name_raw, expert, reserved, offset, nbytes = GGML_PACK_ENTRY.unpack(
raw_entry
)
object_index, physical_role_id = divmod(index, len(KIMI_PHYSICAL_ROLES))
layer_index, expected_expert = divmod(object_index, expected_experts)
layer = active_layers[layer_index]
physical_role = KIMI_PHYSICAL_ROLES[physical_role_id]
name = _fixed_string(name_raw)
match = KIMI_EXPERT_RE.fullmatch(name)
if (
match is None
or int(match.group("layer")) != layer
or match.group("role") != physical_role
or expert != expected_expert
or reserved != 0
):
raise ValueError(
f"Kimi expert-pack identity mismatch at index {index}"
)
expected_nbytes = role_nbytes[physical_role]
if (
nbytes != expected_nbytes
or offset % int(pack_manifest["alignment"])
or offset < previous_end
or offset + nbytes > self.path.stat().st_size
):
raise ValueError(
f"Kimi expert-pack range mismatch at index {index}"
)
previous_end = offset + nbytes
object_key = (layer, expert)
if physical_role_id == 0:
self.object_offsets[object_key] = offset
expected_offset = (
self.object_offsets[object_key] + role_offsets[physical_role]View on GitHub (pinned to 0132848349)
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
Defensive patterns
Strategy: validation
Try / catch
try:
pack = KimiExpertPack(path, manifest)
except ValueError as e:
if 'identity mismatch' in str(e):
log.error('pack index entries out of canonical order; re-pack needed')
raise Prevention
- Only use unmodified official packs
- Verify full SHA-256 before loading to catch any corruption early
When it happens
Trigger: 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.
Common situations: See trigger scenarios.
Related errors
- Kimi active routed MoE layers must be exactly 1..92
- Kimi manifest expert-pack path does not match pack_path
- Kimi expert-pack size does not match its manifest
- Kimi expert-pack physical role order is unsupported
- Kimi expert-pack role sizes do not match object bytes
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/7b5fb3f72b016592.
Report an issue: GitHub.