{"record":{"id":"6bb5022b1008cc19","repo":"sgl-project/sglang","slug":"dspark-requires-speculative-dspark-block-size-to","errorCode":null,"errorMessage":"DSpark requires --speculative-dspark-block-size to be positive, got {}.","messagePattern":"DSpark requires --speculative-dspark-block-size to be positive, got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/arg_groups/speculative_hook.py","lineNumber":473,"sourceCode":"    from sglang.srt.speculative.dspark_components.dspark_config import (\n        DEFAULT_DSPARK_GAMMA,\n        read_draft_checkpoint_config,\n    )\n\n    draft_config = None\n    try:\n        draft_config = read_draft_checkpoint_config(server_args=server_args)\n    except Exception as e:\n        logger.warning(\n            \"Failed to read DSpark draft config; preserving explicit/default \"\n            \"gamma resolution. Error: %s\",\n            e,\n        )\n\n    gamma: Optional[int] = None\n    if cfg.speculative_dspark_block_size is not None:\n        if int(cfg.speculative_dspark_block_size) <= 0:\n            raise ValueError(\n                \"DSpark requires --speculative-dspark-block-size to be positive, \"\n                f\"got {cfg.speculative_dspark_block_size}.\"\n            )\n        gamma = int(cfg.speculative_dspark_block_size)\n    else:\n        if draft_config is not None:\n            gamma = draft_config.resolve_gamma(default=None)\n        if gamma is None and cfg.speculative_num_draft_tokens is None:\n            gamma = DEFAULT_DSPARK_GAMMA\n            logger.warning(\n                \"DSpark gamma is not set; defaulting to %d.\",\n                gamma,\n            )\n\n    if gamma is not None:\n        verify_window = int(gamma) + 1\n        if (\n            cfg.speculative_num_draft_tokens is not None","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/arg_groups/speculative_hook.py#L455-L491","documentation":"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.","triggerScenarios":"Passing --speculative-dspark-block-size 0 or negative on a DSpark launch.","commonSituations":"Placeholder 0 in templated configs meaning 'auto'; env interpolation errors; copy from a different algorithm's flag semantics.","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"],"exampleFix":"# before\n--speculative-dspark-block-size 0\n# after\n--speculative-dspark-block-size 4","handlingStrategy":"validation","validationCode":"if args.speculative_dspark_block_size is not None and int(args.speculative_dspark_block_size) <= 0:\n    raise SystemExit('dspark block size (gamma) must be positive')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use 0 as an 'auto' placeholder; omit the flag instead"],"tags":["speculative-decoding","dspark","argument-validation","block-size"],"backgroundTag":"invalid-argument-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}