sgl-project/sglang · critical · ValueError

Kimi expert-pack size does not match its manifest

Error message

Kimi expert-pack size does not match its manifest

What it means

The expert_pack.size recorded in the manifest differs from the actual on-disk size of the pack file (path.stat().st_size). This detects truncated downloads, partially written packs, or manifest/pack version skew before any bytes are parsed.

Source

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

            int(model["num_hidden_layers"]),
            int(model["num_experts"]),
            int(model["num_experts_per_token"]),
        )
        expected_dimensions = (expected_layers, expected_experts, expected_top_k)
        if dimensions != expected_dimensions or expected_top_k != 16:
            raise ValueError(
                f"Kimi expert-pack dimensions {dimensions} != {expected_dimensions}; "
                "Top-K is immutable at 16"
            )
        active_layers = tuple(int(value) for value in model["active_moe_layer_ids"])
        if active_layers != tuple(range(1, 93)):
            raise ValueError("Kimi active routed MoE layers must be exactly 1..92")

        pack_manifest = self.manifest["expert_pack"]
        if Path(pack_manifest["path"]).resolve() != self.path:
            raise ValueError("Kimi manifest expert-pack path does not match pack_path")
        if int(pack_manifest["size"]) != self.path.stat().st_size:
            raise ValueError("Kimi expert-pack size does not match its manifest")
        if pack_manifest.get("physical_role_order") != list(KIMI_PHYSICAL_ROLES):
            raise ValueError("Kimi expert-pack physical role order is unsupported")
        roles = pack_manifest["roles"]
        expected_roles = {
            "up": ("Q2_K", 10),
            "gate": ("Q2_K", 10),
            "down": ("Q3_K", 11),
        }
        for role, (dtype, dtype_id) in expected_roles.items():
            if (
                roles[role]["dtype"] != dtype
                or int(roles[role]["dtype_id"]) != dtype_id
            ):
                raise ValueError(f"Kimi expert-pack {role} quant type is unsupported")

        expected_entry_count = len(active_layers) * expected_experts * len(ROLE_NAMES)
        index_digest = hashlib.sha256()
        self.entries: dict[tuple[int, int, int], ExpertPackEntry] = {}

View on GitHub (pinned to 0132848349)

Solutions

  1. Re-download or re-copy the pack file and verify its size matches the manifest
  2. If the pack is correct and the manifest stale, regenerate the manifest
  3. Check disk space if the pack was produced locally

Example fix

// before
$ ls -l model.pack   # 12345678 bytes, manifest says 123456780
// after
# resume/redo download until size == manifest.expert_pack.size
Defensive patterns

Strategy: validation

Validate before calling

import os
if os.path.getsize(pack_path) != int(manifest['expert_pack']['size']):
    raise RuntimeError('pack size mismatch — likely truncated download')

Prevention

When it happens

Trigger: Interrupted download or copy of the .pack file; manifest generated against a different revision of the pack; filesystem corruption.

Common situations: See trigger scenarios.

Related errors


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