sgl-project/sglang · error · ValueError
manual_divisions must have {expected} entries, but got {len(
Error message
manual_divisions must have {expected} entries, but got {len(manual_divisions)} What it means
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.
Source
Thrown at python/sglang/srt/multiplex/pdmux_context.py:42
def load_pdmux_config(config_path: str) -> PDMuxConfig:
"""Load pdmux configuration from YAML file into a dataclass."""
if not config_path:
return PDMuxConfig()
with open(config_path, "r") as f:
raw = yaml.safe_load(f)
if "sm_group_num" not in raw:
raise ValueError("Missing required field: sm_group_num")
if raw["sm_group_num"] < 3:
raise ValueError("sm_group_num must be >= 3")
manual_divisions = raw.get("manual_divisions", [])
expected = raw["sm_group_num"] - 2
if manual_divisions and len(manual_divisions) != expected:
raise ValueError(
f"manual_divisions must have {expected} entries, "
f"but got {len(manual_divisions)}"
)
return PDMuxConfig(
sm_group_num=raw["sm_group_num"],
manual_divisions=manual_divisions,
split_forward_token_budget=raw.get("split_forward_token_budget", 65536),
decode_bs_divisor=raw.get("decode_bs_divisor", 36),
)
def get_arch_constraints(compute_capability):
major, minor = compute_capability
# green context constraints for different architectures
if major == 6:
return 1, 1 # min_per_part, multiple
elif major == 7:View on GitHub (pinned to 0132848349)
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
Example fix
# before sm_group_num: 5 manual_divisions: [40, 60] # after sm_group_num: 5 manual_divisions: [30, 45, 60]
Defensive patterns
Strategy: validation
Validate before calling
if manual_divisions:
assert len(manual_divisions) == raw['sm_group_num'] - 2, 'manual_divisions length mismatch' Prevention
- When editing one of sm_group_num or manual_divisions, update the other
- Prefer automatic division (omit manual_divisions) unless tuning
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Missing required field: sm_group_num
- sm_group_num must be >= 3
- No valid partitions found for total SMs {total_sms} with con
- This browser cannot encode H.264 MP4
- H.264 encoder did not return MP4 decoder config
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/5259aaece113a73f.
Report an issue: GitHub.