sgl-project/sglang · error · ValueError

Decode context parallel size (--dcp-size / --decode-context-

Error message

Decode context parallel size (--dcp-size / --decode-context-parallel-size) must be >= 1, but got dcp_size={cfg.dcp_size}.

What it means

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.

Source

Thrown at python/sglang/srt/server_args.py:4256

            if (
                model_path is not None
                and model_path not in seen_paths
                and is_runai_obj_uri(model_path)
            ):
                ObjectStorageModel.download_and_get_path(model_path)
                seen_paths.add(model_path)

    def _handle_pd_disaggregation(self):
        from sglang.srt.arg_groups.pd_disaggregation_hook import (
            handle_pd_disaggregation,
        )

        handle_pd_disaggregation(self)

    def _handle_dcp_validation(self):
        cfg = resolving_view(self)
        if cfg.dcp_size < 1:
            raise ValueError(
                "Decode context parallel size (--dcp-size / "
                "--decode-context-parallel-size) must be >= 1, but got "
                f"dcp_size={cfg.dcp_size}."
            )
        if cfg.dcp_comm_backend in ("a2a", "fi_a2a") and cfg.dcp_size <= 1:
            raise ValueError(
                f"--dcp-comm-backend {cfg.dcp_comm_backend} only affects the "
                "decode context-parallel attention reduction and therefore "
                "requires --dcp-size / --decode-context-parallel-size > 1, but "
                f"got dcp_size={cfg.dcp_size}."
            )
        if cfg.dcp_comm_backend == "fi_a2a" and not is_cuda():
            raise ValueError(
                "--dcp-comm-backend fi_a2a delegates the exchange to FlashInfer's "
                "MNNVL All-to-All kernel, which requires an NVIDIA CUDA platform "
                "with SM90+ and MNNVL fabric memory (e.g. GB200 NVL72). The "
                "authoritative fabric probe runs at model-runner init; use 'a2a' "
                "or 'ag_rs' on clusters without MNNVL."

View on GitHub (pinned to 0132848349)

Solutions

  1. Use dcp_size=1 (or omit the flag) to disable DCP.
  2. Fix the derivation so it never yields < 1, e.g. max(1, world // tp // dp), and only enable DCP when there are spare ranks.

Example fix

# before
python -m sglang.launch_server --model m --tp 8 --dcp-size $((0))
# after
python -m sglang.launch_server --model m --tp 8 --dcp-size 1  # DCP off
Defensive patterns

Strategy: validation

Validate before calling

dcp_size = max(1, dcp_size)
assert dcp_size >= 1

Type guard

def valid_dcp_size(n) -> bool:
    return isinstance(n, int) and n >= 1

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/874191bbeaa96b01. Report an issue: GitHub.