sgl-project/sglang · error · ValueError

PP consensus is required when pp_size > 1

Error message

PP consensus is required when pp_size > 1

What it means

pop_preallocated in PP (pipeline-parallel > 1) mode requires the cross-PP consensus sets pp_good_rids/pp_bad_rids so all pipeline stages agree on which requests were successfully preallocated. When pp_size > 1 and either list is None, consensus cannot be established and the method raises.

Source

Thrown at python/sglang/srt/disaggregation/decode.py:1080

                prefetched = self._prefill_dp_rank_queries.pop(bootstrap_addr, None)
                if prefetched is not None:
                    prefetched[1].cancel()

        self.pending_reqs = remaining

        for decode_req, prefill_dp_rank in resolved:
            decode_req.kv_receiver.init(prefill_dp_rank)

    def pop_preallocated(
        self,
        rids_to_check: Optional[List[str]] = None,
        pp_good_rids: Optional[List[str]] = None,
        pp_bad_rids: Optional[List[str]] = None,
    ) -> Tuple[List[DecodeRequest], List[DecodeRequest]]:
        """Pop the preallocated requests from the pending queue (FIFO)."""
        is_pp_mode = self.pp_size > 1
        if is_pp_mode and (pp_good_rids is None or pp_bad_rids is None):
            raise ValueError("PP consensus is required when pp_size > 1")
        if is_pp_mode and rids_to_check is not None:
            raise ValueError("rids_to_check cannot be used in PP mode")

        self._resolve_pending_reqs()
        self._update_handshake_waiters(rids_to_check, pp_good_rids, pp_bad_rids)
        if is_pp_mode:
            rids_to_check = set(pp_good_rids) | set(pp_bad_rids)

        failed_reqs = []
        preallocated_reqs = []
        indices_to_remove = set()

        # We need to make sure that the sum of inflight tokens and allocatable tokens is greater than maximum input+output length of each inflight request
        # Otherwise it is possible for one request running decode out of memory, while all other requests are in the transfer queue that cannot be retracted.
        retractable_tokens = sum(
            len(r.origin_input_ids) + len(r.output_ids)
            for r in self.scheduler.running_batch.reqs
        )

View on GitHub (pinned to 0132848349)

Solutions

  1. Pass both pp_good_rids and pp_bad_rids (from the PP handshake/consensus step) whenever pp_size > 1
  2. Do not pass rids_to_check in PP mode — use the consensus lists instead
  3. In tests, construct the consensus lists explicitly when simulating PP mode

Example fix

# before
good, bad = queue.pop_preallocated()  # pp_size > 1
# after
good, bad = queue.pop_preallocated(
    pp_good_rids=good_rids, pp_bad_rids=bad_rids)
Defensive patterns

Strategy: validation

Validate before calling

if queue.pp_size > 1:
    assert pp_good_rids is not None and pp_bad_rids is not None

Prevention

When it happens

Trigger: Calling pop_preallocated with self.pp_size > 1 and pp_good_rids=None or pp_bad_rids=None — e.g. a scheduler path or test invoking it without forwarding the PP handshake results.

Common situations: New scheduler code paths (or tests) that call pop_preallocated with only rids_to_check; refactors dropping the consensus arguments; single-node code reused against a PP deployment.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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