sgl-project/sglang · error · ValueError

VerifyCommit committed_tokens must be non-empty: request_id=

Error message

VerifyCommit committed_tokens must be non-empty: request_id={self.request_id} pre_verify_committed_len={self.pre_verify_committed_len}

What it means

VerifyCommit.validate_committed_tokens requires that at least one token was accepted/committed by verification before appending the message to the decoupled draft scheduler stream. An empty committed_tokens list means nothing was verified, which the protocol treats as invalid state and rejects with the request_id and pre-verify committed length for debugging.

Source

Thrown at python/sglang/srt/speculative/decoupled_spec_io.py:95

    and sometimes needs to truncate tokens / reprefill.
    """

    request_id: str
    src_verifier_rank: int
    dst_drafter_rank: int
    pre_verify_committed_len: int
    committed_tokens: list[int]

    @property
    def draft_key(self) -> DraftReqKey:
        return DraftReqKey(
            src_verifier_rank=int(self.src_verifier_rank),
            request_id=self.request_id,
        )

    def validate_committed_tokens(self) -> None:
        if not self.committed_tokens:
            raise ValueError(
                "VerifyCommit committed_tokens must be non-empty: "
                f"request_id={self.request_id} "
                f"pre_verify_committed_len={self.pre_verify_committed_len}"
            )
        if int(self.pre_verify_committed_len) < 0:
            raise ValueError(
                "VerifyCommit pre_verify_committed_len must be non-negative: "
                f"request_id={self.request_id} "
                f"pre_verify_committed_len={self.pre_verify_committed_len}"
            )


@dataclass
class DraftClose:
    request_id: str
    src_verifier_rank: int
    dst_drafter_rank: int
    reason: str

View on GitHub (pinned to 0132848349)

Solutions

  1. Check committed_tokens before committing; if empty, send the appropriate reject/abort control message instead of VerifyCommit
  2. Fix upstream logic that drops accepted tokens (off-by-one in accept_length handling)
  3. If drafts are always fully rejected, debug draft-model compatibility/weights rather than the commit path

Example fix

# before
msg = VerifyCommit(key, committed_tokens=[], pre_verify_committed_len=n)
stream.append_message(msg)
# after
if accepted:
    stream.append_message(VerifyCommit(key, committed_tokens=accepted, pre_verify_committed_len=n))
else:
    stream.append_message(DraftAbort(key))  # or equivalent rejection path
Defensive patterns

Strategy: validation

Validate before calling

if not commit.committed_tokens:
    # nothing accepted: use the abort/reject path instead
    send_abort(commit.request_id)
else:
    stream.append_message(commit)

Type guard

def is_valid_commit(commit) -> bool:
    return bool(commit.committed_tokens) and int(commit.pre_verify_committed_len) >= 0

Try / catch

try:
    stream.append_message(msg)
except ValueError as e:
    if "committed_tokens must be non-empty" in str(e):
        handle_full_rejection(msg.request_id)
    else:
        raise

Prevention

When it happens

Trigger: Calling append_message (or validating) a VerifyCommit whose committed_tokens is empty — e.g. the verifier rejected every draft token and produced no accepted continuation (covered by test_empty_tokens_raises).

Common situations: Draft model consistently rejected (poor draft quality, temperature 0 mismatch), a bug zeroing the accepted-token list, or mishandling the 'all spec tokens rejected' case as a commit instead of an abort/reject message.

Related errors


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