sgl-project/sglang · critical · ValueError

Kimi expert-pack header does not match its manifest

Error message

Kimi expert-pack header does not match its manifest

What it means

The binary header fields (magic, version=1, header_size, index_count == expected entry count, data_start) disagree with the manifest or the fixed format. This catches wrong file format, version skew, or manifest/header mismatch before the index is parsed.

Source

Thrown at python/sglang/srt/layers/moe/expert_pack.py:812

        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)
                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

View on GitHub (pinned to 0132848349)

Solutions

  1. Confirm the file is a Kimi expert-pack produced by the matching tool version
  2. Regenerate both pack and manifest together from the same tool run
  3. Check magic bytes with a hex dump (xxd file | head -1) to rule out a wrong/HTML error file
Defensive patterns

Strategy: validation

Validate before calling

import struct
magic, version, hsize, count, data_start = struct.unpack('<5Q', open(pack_path,'rb').read(40))
assert magic == GGML_PACK_MAGIC and version == 1 and count == 92 * n_experts * 3

Prevention

When it happens

Trigger: Opening a non-pack file (e.g. a GGUF or safetensors); a pack written by a newer/older format version; manifest's data_start inconsistent with the header.

Common situations: See trigger scenarios.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/a62c239e19899870. Report an issue: GitHub.