{"record":{"id":"f9e3485dd6cbfdae","repo":"sgl-project/sglang","slug":"ep-dispatch-algorithm-cfg-ep-dispatch-algorithm","errorCode":null,"errorMessage":"--ep-dispatch-algorithm {cfg.ep_dispatch_algorithm} picks a different physical replica per rank, which only holds up when an a2a backend routes each token to a single rank. Use --ep-dispatch-algorithm dynamic with --moe-a2a-backend none.","messagePattern":"--ep-dispatch-algorithm (.+?) picks a different physical replica per rank, which only holds up when an a2a backend routes each token to a single rank\\. Use --ep-dispatch-algorithm dynamic with --moe-a2a-backend none\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":7897,"sourceCode":"        needs_rank_invariant_dispatch = self._resolved().moe_a2a_backend == \"none\"\n\n        if (cfg.enable_eplb or (cfg.init_expert_location != \"trivial\")) and (\n            cfg.ep_dispatch_algorithm is None\n        ):\n            self._declare(\n                \"_handle_eplb_and_dispatch\",\n                ep_dispatch_algorithm=(\n                    \"dynamic\" if needs_rank_invariant_dispatch else \"static\"\n                ),\n            )\n\n        # `dynamic` / `fake` switch to the row-index pick; `static` reads a\n        # per-rank table and `lp` samples inside its kernel.\n        if needs_rank_invariant_dispatch and cfg.ep_dispatch_algorithm in (\n            \"static\",\n            \"lp\",\n        ):\n            raise ValueError(\n                f\"--ep-dispatch-algorithm {cfg.ep_dispatch_algorithm} picks a \"\n                \"different physical replica per rank, which only holds up when an \"\n                \"a2a backend routes each token to a single rank. Use \"\n                \"--ep-dispatch-algorithm dynamic with --moe-a2a-backend none.\"\n            )\n\n        if cfg.enable_eplb and cfg.ep_join_mode != \"scale\":\n            assert self._resolved().ep_size > 1\n\n    def _handle_elastic_ep(self):\n        cfg = resolving_view(self)\n        if cfg.elastic_ep_rejoin:\n            if cfg.ep_join_mode is None:\n                logger.warning(\n                    \"--elastic-ep-rejoin is deprecated, use --elastic-ep-join-mode recover instead.\"\n                )\n                self._declare(\n                    \"_handle_elastic_ep\",","sourceCodeStart":7879,"sourceCodeEnd":7915,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L7879-L7915","documentation":"Raised when --ep-dispatch-algorithm is 'static' or 'lp' while there is no single-rank-routing a2a backend (needs_rank_invariant_dispatch). Those algorithms pick a different physical replica per rank, which is only consistent if each token is routed to exactly one rank; with --moe-a2a-backend none the dispatch must be rank-invariant, so only 'dynamic'/'fake' are allowed.","triggerScenarios":"Configuring --ep-dispatch-algorithm static or lp together with --moe-a2a-backend none (or any config where needs_rank_invariant_dispatch is true).","commonSituations":"Tuning EPLB dispatch for locality/power-aware placement with the a2a backend disabled; reusing an EPLB-tuned config on a single-node deployment that runs MoE without a2a.","solutions":["Set --ep-dispatch-algorithm dynamic when using --moe-a2a-backend none","Enable an a2a backend (e.g. --moe-a2a-backend deepep) so single-rank routing holds and static/lp become valid"],"exampleFix":"# before\n--moe-a2a-backend none --ep-dispatch-algorithm lp\n# after\n--moe-a2a-backend none --ep-dispatch-algorithm dynamic","handlingStrategy":"validation","validationCode":"if ep_dispatch_algorithm in (\"static\", \"lp\") and moe_a2a_backend == \"none\":\n    ep_dispatch_algorithm = \"dynamic\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default --ep-dispatch-algorithm to dynamic in generic launch scripts","Only enable static/lp when an a2a backend with single-rank token routing is on"],"tags":["eplb","dispatch-algorithm","moe","a2a-backend","server-args"],"backgroundTag":"unsupported-configuration-combo","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}