sgl-project/sglang · error · ValueError
DSpark requires --speculative-dspark-block-size to be positi
Error message
DSpark requires --speculative-dspark-block-size to be positive, got {}. What it means
The DSpark block size (gamma, the number of draft tokens per step) must be a positive integer. Non-positive values break the gamma+1 verify-window arithmetic and are rejected up front.
Source
Thrown at python/sglang/srt/arg_groups/speculative_hook.py:473
from sglang.srt.speculative.dspark_components.dspark_config import (
DEFAULT_DSPARK_GAMMA,
read_draft_checkpoint_config,
)
draft_config = None
try:
draft_config = read_draft_checkpoint_config(server_args=server_args)
except Exception as e:
logger.warning(
"Failed to read DSpark draft config; preserving explicit/default "
"gamma resolution. Error: %s",
e,
)
gamma: Optional[int] = None
if cfg.speculative_dspark_block_size is not None:
if int(cfg.speculative_dspark_block_size) <= 0:
raise ValueError(
"DSpark requires --speculative-dspark-block-size to be positive, "
f"got {cfg.speculative_dspark_block_size}."
)
gamma = int(cfg.speculative_dspark_block_size)
else:
if draft_config is not None:
gamma = draft_config.resolve_gamma(default=None)
if gamma is None and cfg.speculative_num_draft_tokens is None:
gamma = DEFAULT_DSPARK_GAMMA
logger.warning(
"DSpark gamma is not set; defaulting to %d.",
gamma,
)
if gamma is not None:
verify_window = int(gamma) + 1
if (
cfg.speculative_num_draft_tokens is not NoneView on GitHub (pinned to 0132848349)
Solutions
- Set --speculative-dspark-block-size to a positive int (typical gamma 3-8)
- Omit the flag to let DSpark infer gamma from the draft config
- Sanity-check the value in your launch script before passing it
Example fix
# before --speculative-dspark-block-size 0 # after --speculative-dspark-block-size 4
Defensive patterns
Strategy: validation
Validate before calling
if args.speculative_dspark_block_size is not None and int(args.speculative_dspark_block_size) <= 0:
raise SystemExit('dspark block size (gamma) must be positive') Prevention
- Never use 0 as an 'auto' placeholder; omit the flag instead
When it happens
Trigger: Passing --speculative-dspark-block-size 0 or negative on a DSpark launch.
Common situations: Placeholder 0 in templated configs meaning 'auto'; env interpolation errors; copy from a different algorithm's flag semantics.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- DFLASH requires --speculative-dflash-block-size to be positi
- DSpark speculative_num_draft_tokens must be >= 2 (= gamma +
- DSPARK requires explicit layer_ids for aux hidden capture.
- Unknown match_type: '{match_type}'. Must be 'BFS' or 'PROB'.
- Kimi-K3 DCP + DSPARK currently requires SGLANG_RAGGED_VERIFY
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/6bb5022b1008cc19.
Report an issue: GitHub.