{"record":{"id":"874191bbeaa96b01","repo":"sgl-project/sglang","slug":"decode-context-parallel-size-dcp-size-decod","errorCode":null,"errorMessage":"Decode context parallel size (--dcp-size / --decode-context-parallel-size) must be >= 1, but got dcp_size={cfg.dcp_size}.","messagePattern":"Decode context parallel size \\(--dcp-size / --decode-context-parallel-size\\) must be >= 1, but got dcp_size=(.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":4256,"sourceCode":"            if (\n                model_path is not None\n                and model_path not in seen_paths\n                and is_runai_obj_uri(model_path)\n            ):\n                ObjectStorageModel.download_and_get_path(model_path)\n                seen_paths.add(model_path)\n\n    def _handle_pd_disaggregation(self):\n        from sglang.srt.arg_groups.pd_disaggregation_hook import (\n            handle_pd_disaggregation,\n        )\n\n        handle_pd_disaggregation(self)\n\n    def _handle_dcp_validation(self):\n        cfg = resolving_view(self)\n        if cfg.dcp_size < 1:\n            raise ValueError(\n                \"Decode context parallel size (--dcp-size / \"\n                \"--decode-context-parallel-size) must be >= 1, but got \"\n                f\"dcp_size={cfg.dcp_size}.\"\n            )\n        if cfg.dcp_comm_backend in (\"a2a\", \"fi_a2a\") and cfg.dcp_size <= 1:\n            raise ValueError(\n                f\"--dcp-comm-backend {cfg.dcp_comm_backend} only affects the \"\n                \"decode context-parallel attention reduction and therefore \"\n                \"requires --dcp-size / --decode-context-parallel-size > 1, but \"\n                f\"got dcp_size={cfg.dcp_size}.\"\n            )\n        if cfg.dcp_comm_backend == \"fi_a2a\" and not is_cuda():\n            raise ValueError(\n                \"--dcp-comm-backend fi_a2a delegates the exchange to FlashInfer's \"\n                \"MNNVL All-to-All kernel, which requires an NVIDIA CUDA platform \"\n                \"with SM90+ and MNNVL fabric memory (e.g. GB200 NVL72). The \"\n                \"authoritative fabric probe runs at model-runner init; use 'a2a' \"\n                \"or 'ag_rs' on clusters without MNNVL.\"","sourceCodeStart":4238,"sourceCodeEnd":4274,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L4238-L4274","documentation":"The decode context parallel size (dcp_size) must be at least 1. _handle_dcp_validation rejects values < 1 because dcp_size=1 is the 'disabled' sentinel and 0/negative sizes make the DCP world-size arithmetic invalid.","triggerScenarios":"Passing --dcp-size 0 (or a negative number), or computing dcp_size programmatically (e.g. world_size // dp_size // tp_size) and underflowing to 0 on small node counts.","commonSituations":"Generic launcher scripts that derive parallel sizes by division and get 0 when TP/DP already consume all ranks; explicitly passing 0 intending 'off' instead of 1.","solutions":["Use dcp_size=1 (or omit the flag) to disable DCP.","Fix the derivation so it never yields < 1, e.g. max(1, world // tp // dp), and only enable DCP when there are spare ranks."],"exampleFix":"# before\npython -m sglang.launch_server --model m --tp 8 --dcp-size $((0))\n# after\npython -m sglang.launch_server --model m --tp 8 --dcp-size 1  # DCP off","handlingStrategy":"validation","validationCode":"dcp_size = max(1, dcp_size)\nassert dcp_size >= 1","typeGuard":"def valid_dcp_size(n) -> bool:\n    return isinstance(n, int) and n >= 1","tryCatchPattern":null,"preventionTips":["Clamp derived parallel sizes with max(1, ...).","Use dcp_size=1 (or omit) to disable DCP, never 0."],"tags":["server-args","dcp","parallelism","validation","sglang"],"backgroundTag":"invalid-parallel-size","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}