sgl-project/sglang · critical · ValueError

Kimi expert-pack SHA-256 does not match manifest

Error message

Kimi expert-pack SHA-256 does not match manifest

What it means

Full-file SHA-256 (_sha256_file over the whole pack) does not match manifest.expert_pack.sha256 when verify_pack_sha256 is enabled. The file content differs from the recorded digest — corruption, partial download, or wrong revision.

Source

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

                    quant_scheme=str(roles[physical_role]["dtype"]),
                    transform_id="identity-v1",
                    block_size=256,
                    generation=generation,
                )

        if previous_end != self.path.stat().st_size:
            raise ValueError("Kimi expert-pack file has trailing or missing bytes")
        actual_index_sha256 = index_digest.hexdigest()
        if actual_index_sha256 != pack_manifest["index_sha256"]:
            raise ValueError("Kimi expert-pack index SHA-256 does not match manifest")
        if verify_pack_sha256:
            expected_sha256 = pack_manifest.get("sha256")
            if not expected_sha256:
                raise ValueError(
                    "full pack verification requested, but manifest has no full SHA-256"
                )
            if _sha256_file(self.path) != expected_sha256:
                raise ValueError("Kimi expert-pack SHA-256 does not match manifest")

        self.header = ExpertPackHeader(
            flags=REQUIRED_FLAGS,
            index_count=expected_entry_count,
            data_start=int(pack_manifest["data_start"]),
            alignment=int(pack_manifest["alignment"]),
            num_layers=expected_layers,
            num_experts=expected_experts,
            top_k=expected_top_k,
            role_count=len(ROLE_NAMES),
            model_identity_sha256="0" * 64,
            source_blob_sha256=str(self.manifest["source"]["inventory_sha256"]),
            config_sha256=str(model["config_sha256"]),
        )
        self.active_moe_layer_ids = frozenset(active_layers)
        self.role_offsets = role_offsets
        self.role_nbytes = role_nbytes
        self.role_bytes = role_nbytes["gate"]

View on GitHub (pinned to 0132848349)

Solutions

  1. Re-download the pack from the original source and re-verify the digest
  2. If the pack was legitimately regenerated, recompute and update manifest sha256
  3. Use sha256sum locally to compare before retrying the load
Defensive patterns

Strategy: validation

Validate before calling

import hashlib
sha = hashlib.sha256(open(pack_path,'rb').read()).hexdigest()
assert sha == manifest['expert_pack']['sha256'], 'pack file digest mismatch'

Try / catch

try:
    pack = KimiExpertPack(path, manifest, verify_pack_sha256=True)
except ValueError as e:
    if 'SHA-256 does not match' in str(e):
        log.error('corrupt or wrong-revision pack; re-download')
    raise

Prevention

When it happens

Trigger: verify_pack_sha256=True with a truncated/re-downgraded/modified pack, or a sha256 recorded for a different file version.

Common situations: See trigger scenarios.

Related errors


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