{"record":{"id":"5259aaece113a73f","repo":"sgl-project/sglang","slug":"manual-divisions-must-have-expected-entries-but","errorCode":null,"errorMessage":"manual_divisions must have {expected} entries, but got {len(manual_divisions)}","messagePattern":"manual_divisions must have (.+?) entries, but got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multiplex/pdmux_context.py","lineNumber":42,"sourceCode":"def load_pdmux_config(config_path: str) -> PDMuxConfig:\n    \"\"\"Load pdmux configuration from YAML file into a dataclass.\"\"\"\n    if not config_path:\n        return PDMuxConfig()\n\n    with open(config_path, \"r\") as f:\n        raw = yaml.safe_load(f)\n\n    if \"sm_group_num\" not in raw:\n        raise ValueError(\"Missing required field: sm_group_num\")\n\n    if raw[\"sm_group_num\"] < 3:\n        raise ValueError(\"sm_group_num must be >= 3\")\n\n    manual_divisions = raw.get(\"manual_divisions\", [])\n\n    expected = raw[\"sm_group_num\"] - 2\n    if manual_divisions and len(manual_divisions) != expected:\n        raise ValueError(\n            f\"manual_divisions must have {expected} entries, \"\n            f\"but got {len(manual_divisions)}\"\n        )\n\n    return PDMuxConfig(\n        sm_group_num=raw[\"sm_group_num\"],\n        manual_divisions=manual_divisions,\n        split_forward_token_budget=raw.get(\"split_forward_token_budget\", 65536),\n        decode_bs_divisor=raw.get(\"decode_bs_divisor\", 36),\n    )\n\n\ndef get_arch_constraints(compute_capability):\n    major, minor = compute_capability\n    # green context constraints for different architectures\n    if major == 6:\n        return 1, 1  # min_per_part, multiple\n    elif major == 7:","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multiplex/pdmux_context.py#L24-L60","documentation":"When manual SM division boundaries are supplied, they must partition the SM range into exactly sm_group_num-1 boundaries (sm_group_num groups). A mismatched list length means the partition count won't equal the requested group count.","triggerScenarios":"Providing manual_divisions with len != sm_group_num - 2... specifically != sm_group_num - 2 entries per the computed 'expected' value, e.g. 2 entries with sm_group_num=6.","commonSituations":"Editing the YAML to add/remove a boundary while forgetting to update sm_group_num; copying a manual_divisions list from a config with a different group count.","solutions":["Make len(manual_divisions) == sm_group_num - 2","Or drop manual_divisions entirely to let divide_sm pick partitions automatically","Double-check off-by-one: N groups need N-2 manual boundaries in this scheme"],"exampleFix":"# before\nsm_group_num: 5\nmanual_divisions: [40, 60]\n# after\nsm_group_num: 5\nmanual_divisions: [30, 45, 60]","handlingStrategy":"validation","validationCode":"if manual_divisions:\n    assert len(manual_divisions) == raw['sm_group_num'] - 2, 'manual_divisions length mismatch'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When editing one of sm_group_num or manual_divisions, update the other","Prefer automatic division (omit manual_divisions) unless tuning"],"tags":["pdmux","config","partitioning"],"backgroundTag":"config-length-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}