sgl-project/sglang · critical · ValueError
Kimi expert-pack header is truncated
Error message
Kimi expert-pack header is truncated
What it means
The first GGML_PACK_HEADER.size bytes read from the pack file are shorter than the fixed header struct, i.e. the file is smaller than a valid header. The pack is unusable — almost certainly truncated or empty.
Source
Thrown at python/sglang/srt/layers/moe/expert_pack.py:800
self.entries: dict[tuple[int, int, int], ExpertPackEntry] = {}
self.object_offsets: dict[tuple[int, int], int] = {}
object_payload_bytes = int(pack_manifest["object_bytes"])
previous_end = int(pack_manifest["data_start"])
role_offsets: dict[str, int] = {}
role_nbytes = {
role: int(roles[role]["expert_bytes"]) for role in KIMI_PHYSICAL_ROLES
}
running_role_offset = 0
for role in KIMI_PHYSICAL_ROLES:
role_offsets[role] = running_role_offset
running_role_offset += role_nbytes[role]
if running_role_offset != object_payload_bytes:
raise ValueError("Kimi expert-pack role sizes do not match object bytes")
with self.path.open("rb", buffering=0) as stream:
raw_header = stream.read(GGML_PACK_HEADER.size)
if len(raw_header) != GGML_PACK_HEADER.size:
raise ValueError("Kimi expert-pack header is truncated")
index_digest.update(raw_header)
magic, version, header_size, index_count, data_start = (
GGML_PACK_HEADER.unpack(raw_header)
)
if (
magic != GGML_PACK_MAGIC
or version != 1
or header_size != GGML_PACK_HEADER.size
or index_count != expected_entry_count
or data_start != int(pack_manifest["data_start"])
):
raise ValueError("Kimi expert-pack header does not match its manifest")
for index in range(index_count):
raw_entry = stream.read(GGML_PACK_ENTRY.size)
if len(raw_entry) != GGML_PACK_ENTRY.size:
raise ValueError("Kimi expert-pack index is truncated")
index_digest.update(raw_entry)View on GitHub (pinned to 0132848349)
Solutions
- Verify the file path points at the real pack
- Re-download/recreate the pack and check size against the manifest before loading
Example fix
// before
pack = KimiExpertPack(Path('/data/model.pack.tmp'))
// after
assert p.stat().st_size == manifest['expert_pack']['size']
pack = KimiExpertPack(p) Defensive patterns
Strategy: validation
Validate before calling
import struct
HEADER_SIZE = struct.calcsize('<5Q') # match GGML_PACK_HEADER.size
if pack_path.stat().st_size < HEADER_SIZE:
raise RuntimeError('pack file too small to contain a header') Prevention
- Check file size > header size before opening
- Confirm downloads completed (curl -f, check exit code)
When it happens
Trigger: Opening a 0-byte or few-byte file (failed download, interrupted write, wrong path pointing at a stub file).
Common situations: See trigger scenarios.
Related errors
- expert-pack index is truncated
- 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
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/bdf31bcc008d4691.
Report an issue: GitHub.