sgl-project/sglang · critical · RuntimeError
The size of ({name}) is ({self.name_to_size[name]}), but you
Error message
The size of ({name}) is ({self.name_to_size[name]}), but you haven't specified the order ({self.order}). What it means
A distributed initialization (TP/DP/EP-style group) validates that every parallel dimension with size > 1 appears in the user-supplied `order` string. If, e.g. dp=2 but 'dp' is not in order='tp-ep', it raises this RuntimeError because the rank-mesh layout would be ambiguous.
Source
Thrown at python/sglang/multimodal_gen/runtime/utils/distributed.py:195
self.sp = sp
self.pp = pp
self.cfg = cfg
self.dp = dp
self.rank_offset = rank_offset
self.world_size = tp * sp * pp * cfg * dp
self.name_to_size = {
"tp": self.tp,
"sp": self.sp,
"pp": self.pp,
"cfg": self.cfg,
"dp": self.dp,
}
order = order.lower()
for name in self.name_to_size.keys():
if name not in order and self.name_to_size[name] != 1:
raise RuntimeError(
f"The size of ({name}) is ({self.name_to_size[name]}), but you haven't specified the order ({self.order})."
)
elif name not in order:
order = order + "-" + name
self.order = order
self.ordered_size = []
for token in order.split("-"):
self.ordered_size.append(self.name_to_size[token])
def get_mask(self, order: str, token: str):
ordered_token = order.split("-")
token = token.split("-")
mask = [False] * len(ordered_token)
for t in token:
mask[ordered_token.index(t)] = True
return maskView on GitHub (pinned to 0132848349)
Solutions
- Add the missing dimension to the order string, e.g. order='tp-dp' or 'tp-ep-dp', matching every dimension with size > 1
- Or reduce the missing dimension's size back to 1
- Compute the order programmatically from the active parallel sizes instead of hardcoding
Example fix
# before order="tp" # dp=2 -> error # after order="tp-dp"
Defensive patterns
Strategy: validation
Validate before calling
missing = [k for k, v in name_to_size.items() if v > 1 and k not in order.lower()]
assert not missing, f'add {missing} to order' Prevention
- Derive the order string from active parallel sizes instead of hardcoding
- Add config linting when dp/ep sizes exceed 1
- Test startup with the exact parallel layout used in production
When it happens
Trigger: Constructing the distributed helper with name_to_size containing a dimension >1 (e.g. dp=2) while the `order` argument omits that dimension name. Size-1 dimensions are tolerated and get appended implicitly.
Common situations: Enabling data parallel or expert parallel via server args without updating a hardcoded parallel mesh order string; changing --dp-size from 1 to >1 in configs that only list 'tp'.
Related errors
- world_size ({world_size}) is less than tensor_parallel_degre
- Invalid {tp_size=}. Expected tp_size >= 1.
- kv_gather_degree does not compose with ulysses_degree or rin
- launch_local_runtime requires --dp-size 1; got dp_size={get_
- Encoder DP mode requires --dp-size > 1 and --tp-size 1; got
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/ee5d4174b13f93df.
Report an issue: GitHub.