{"record":{"id":"287f8ab79f21b621","repo":"sgl-project/sglang","slug":"kimi-manifest-expert-pack-path-does-not-match-pack","errorCode":null,"errorMessage":"Kimi manifest expert-pack path does not match pack_path","messagePattern":"Kimi manifest expert-pack path does not match pack_path","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/layers/moe/expert_pack.py","lineNumber":762,"sourceCode":"        model = self.manifest[\"model\"]\n        dimensions = (\n            int(model[\"num_hidden_layers\"]),\n            int(model[\"num_experts\"]),\n            int(model[\"num_experts_per_token\"]),\n        )\n        expected_dimensions = (expected_layers, expected_experts, expected_top_k)\n        if dimensions != expected_dimensions or expected_top_k != 16:\n            raise ValueError(\n                f\"Kimi expert-pack dimensions {dimensions} != {expected_dimensions}; \"\n                \"Top-K is immutable at 16\"\n            )\n        active_layers = tuple(int(value) for value in model[\"active_moe_layer_ids\"])\n        if active_layers != tuple(range(1, 93)):\n            raise ValueError(\"Kimi active routed MoE layers must be exactly 1..92\")\n\n        pack_manifest = self.manifest[\"expert_pack\"]\n        if Path(pack_manifest[\"path\"]).resolve() != self.path:\n            raise ValueError(\"Kimi manifest expert-pack path does not match pack_path\")\n        if int(pack_manifest[\"size\"]) != self.path.stat().st_size:\n            raise ValueError(\"Kimi expert-pack size does not match its manifest\")\n        if pack_manifest.get(\"physical_role_order\") != list(KIMI_PHYSICAL_ROLES):\n            raise ValueError(\"Kimi expert-pack physical role order is unsupported\")\n        roles = pack_manifest[\"roles\"]\n        expected_roles = {\n            \"up\": (\"Q2_K\", 10),\n            \"gate\": (\"Q2_K\", 10),\n            \"down\": (\"Q3_K\", 11),\n        }\n        for role, (dtype, dtype_id) in expected_roles.items():\n            if (\n                roles[role][\"dtype\"] != dtype\n                or int(roles[role][\"dtype_id\"]) != dtype_id\n            ):\n                raise ValueError(f\"Kimi expert-pack {role} quant type is unsupported\")\n\n        expected_entry_count = len(active_layers) * expected_experts * len(ROLE_NAMES)","sourceCodeStart":744,"sourceCodeEnd":780,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/moe/expert_pack.py#L744-L780","documentation":"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.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","solutions":["Regenerate the manifest at the pack's current location so expert_pack.path matches","Or update the path field in the manifest to the resolved absolute path of the pack file you pass as pack_path","Avoid copying manifests between pack files; keep manifest and pack together"],"exampleFix":"// before\npack = KimiExpertPack(Path('/data/model.pack'), manifest_from_other_dir)\n// after\npack = KimiExpertPack(Path('/data/model.pack'), json.load(open('/data/model.pack.manifest.json')))","handlingStrategy":"validation","validationCode":"from pathlib import Path\nassert Path(manifest['expert_pack']['path']).resolve() == pack_path.resolve(), 'manifest/pack path mismatch'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Regenerate the manifest after moving/renaming a pack","Pass absolute, resolved paths to both the loader and the packing tool"],"tags":["kimi","moe","expert-pack","path-mismatch"],"backgroundTag":"manifest-path-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}