{"record":{"id":"1b84a77fcd6255bd","repo":"sgl-project/sglang","slug":"missing-required-field-sm-group-num","errorCode":null,"errorMessage":"Missing required field: sm_group_num","messagePattern":"Missing required field: sm_group_num","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multiplex/pdmux_context.py","lineNumber":33,"sourceCode":"class PDMuxConfig:\n    sm_group_num: int = 8\n    manual_divisions: List[List[int]] = field(\n        default_factory=list\n    )  # [prefill_sm, decode_sm, decode_bs_threshold]\n    split_forward_token_budget: int = 65536\n    decode_bs_divisor: int = 36\n\n\ndef 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),","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multiplex/pdmux_context.py#L15-L51","documentation":"load_pdmux_config parses the PD-multiplexing YAML config; sm_group_num is mandatory because the SM partitioner needs to know how many stream groups to create. Absence means the config file is incomplete.","triggerScenarios":"Calling init_pdmux with a config path whose YAML lacks the top-level sm_group_num key.","commonSituations":"Hand-written or template config with a typo (e.g. sm_groups_num); a config generated for an older sglang version; empty YAML file that parses to None-like dict without the key.","solutions":["Add sm_group_num: <N> (>=3) at the top level of the pdmux YAML","Check spelling/case of the key against the sglang pdmux config schema","Regenerate the config from a known-good example shipped with sglang"],"exampleFix":"# before\n# pdmux.yaml\nmanual_divisions: [...]\n# after\nsm_group_num: 4\nmanual_divisions: [...]","handlingStrategy":"validation","validationCode":"import yaml\nraw = yaml.safe_load(open(cfg_path))\nassert 'sm_group_num' in raw, 'pdmux config missing sm_group_num'","typeGuard":null,"tryCatchPattern":"try:\n    cfg = load_pdmux_config(path)\nexcept ValueError as e:\n    raise SystemExit(f'bad pdmux config: {e}')","preventionTips":["Validate pdmux YAML against the schema at deploy time","Keep an example config in-repo and diff against it after edits"],"tags":["pdmux","config","yaml","missing-field"],"backgroundTag":"missing-config-field","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}