sgl-project/sglang · critical · ValueError

Kimi manifest expert-pack path does not match pack_path

Error message

Kimi manifest expert-pack path does not match pack_path

What it means

The manifest's expert_pack.path, once resolved to an absolute path, does not match the pack file actually being opened (self.path). This guards against loading a pack with a manifest copied from or written for a different file location.

Source

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

        model = self.manifest["model"]
        dimensions = (
            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)

View on GitHub (pinned to 0132848349)

Solutions

  1. Regenerate the manifest at the pack's current location so expert_pack.path matches
  2. Or update the path field in the manifest to the resolved absolute path of the pack file you pass as pack_path
  3. Avoid copying manifests between pack files; keep manifest and pack together

Example fix

// before
pack = KimiExpertPack(Path('/data/model.pack'), manifest_from_other_dir)
// after
pack = KimiExpertPack(Path('/data/model.pack'), json.load(open('/data/model.pack.manifest.json')))
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
assert Path(manifest['expert_pack']['path']).resolve() == pack_path.resolve(), 'manifest/pack path mismatch'

Prevention

When it happens

Trigger: Moving or renaming the .pack file after the manifest was written; passing a symlink or relative path that resolves differently; reusing a manifest JSON alongside a copied pack at another location.

Common situations: See trigger scenarios.

Related errors


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