{"record":{"id":"ee5d4174b13f93df","repo":"sgl-project/sglang","slug":"the-size-of-name-is-self-name-to-size-name","errorCode":null,"errorMessage":"The size of ({name}) is ({self.name_to_size[name]}), but you haven't specified the order ({self.order}).","messagePattern":"The size of \\((.+?)\\) is \\((.+?)\\), but you haven't specified the order \\((.+?)\\)\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"python/sglang/multimodal_gen/runtime/utils/distributed.py","lineNumber":195,"sourceCode":"        self.sp = sp\n        self.pp = pp\n        self.cfg = cfg\n        self.dp = dp\n        self.rank_offset = rank_offset\n        self.world_size = tp * sp * pp * cfg * dp\n\n        self.name_to_size = {\n            \"tp\": self.tp,\n            \"sp\": self.sp,\n            \"pp\": self.pp,\n            \"cfg\": self.cfg,\n            \"dp\": self.dp,\n        }\n        order = order.lower()\n\n        for name in self.name_to_size.keys():\n            if name not in order and self.name_to_size[name] != 1:\n                raise RuntimeError(\n                    f\"The size of ({name}) is ({self.name_to_size[name]}), but you haven't specified the order ({self.order}).\"\n                )\n            elif name not in order:\n                order = order + \"-\" + name\n\n        self.order = order\n        self.ordered_size = []\n\n        for token in order.split(\"-\"):\n            self.ordered_size.append(self.name_to_size[token])\n\n    def get_mask(self, order: str, token: str):\n        ordered_token = order.split(\"-\")\n        token = token.split(\"-\")\n        mask = [False] * len(ordered_token)\n        for t in token:\n            mask[ordered_token.index(t)] = True\n        return mask","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/utils/distributed.py#L177-L213","documentation":"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.","triggerScenarios":"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.","commonSituations":"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'.","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"],"exampleFix":"# before\norder=\"tp\"\n# dp=2 -> error\n# after\norder=\"tp-dp\"","handlingStrategy":"validation","validationCode":"missing = [k for k, v in name_to_size.items() if v > 1 and k not in order.lower()]\nassert not missing, f'add {missing} to order'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["distributed","parallelism","config"],"backgroundTag":"distributed-parallel-config-invalid","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}