{"record":{"id":"1812939c79cb66bb","repo":"sgl-project/sglang","slug":"dflash-requires-speculative-dflash-block-size-to","errorCode":null,"errorMessage":"DFLASH requires --speculative-dflash-block-size to be positive, got {}.","messagePattern":"DFLASH requires --speculative-dflash-block-size to be positive, got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/arg_groups/speculative_hook.py","lineNumber":250,"sourceCode":"        declare_resolution(\n            server_args,\n            \"_handle_dflash\",\n            speculative_eagle_topk=1,\n        )\n    elif int(cfg.speculative_eagle_topk) != 1:\n        logger.warning(\n            \"DFLASH only supports speculative_eagle_topk == 1; overriding speculative_eagle_topk=%s to 1.\",\n            cfg.speculative_eagle_topk,\n        )\n        declare_resolution(\n            server_args,\n            \"_handle_dflash\",\n            speculative_eagle_topk=1,\n        )\n\n    if cfg.speculative_dflash_block_size is not None:\n        if int(cfg.speculative_dflash_block_size) <= 0:\n            raise ValueError(\n                \"DFLASH requires --speculative-dflash-block-size to be positive, \"\n                f\"got {cfg.speculative_dflash_block_size}.\"\n            )\n        if cfg.speculative_num_draft_tokens is not None and int(\n            cfg.speculative_num_draft_tokens\n        ) != int(cfg.speculative_dflash_block_size):\n            raise ValueError(\n                \"Both --speculative-num-draft-tokens and --speculative-dflash-block-size are set \"\n                \"but they differ. For DFLASH they must match. \"\n                f\"speculative_num_draft_tokens={cfg.speculative_num_draft_tokens}, \"\n                f\"speculative_dflash_block_size={cfg.speculative_dflash_block_size}.\"\n            )\n        declare_resolution(\n            server_args,\n            \"_handle_dflash\",\n            speculative_num_draft_tokens=int(cfg.speculative_dflash_block_size),\n        )\n","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/arg_groups/speculative_hook.py#L232-L268","documentation":"The DFLASH block size controls how many tokens are drafted/verified per block and must be a positive integer. A zero or negative value breaks scheduler/KV-cache accounting, so it is rejected during arg validation.","triggerScenarios":"Passing --speculative-dflash-block-size 0 or a negative number (possibly via a config template with an unset/placeholder value).","commonSituations":"Templated launch scripts that default the flag to 0 to mean 'auto'; typo'd values; env-var interpolation producing 0.","solutions":["Set --speculative-dflash-block-size to a positive integer (e.g. 8 or 16)","Omit the flag entirely if you want the default/inferred block size","Check the value is not coming from a misconfigured env var or YAML preset"],"exampleFix":"# before\n--speculative-dflash-block-size 0\n# after\n--speculative-dflash-block-size 16","handlingStrategy":"validation","validationCode":"if args.speculative_dflash_block_size is not None and int(args.speculative_dflash_block_size) <= 0:\n    raise SystemExit('dflash block size must be positive')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use None/omission for defaults, never 0, in config templates","Run a quick argparse sanity pass on rendered launch commands"],"tags":["speculative-decoding","dflash","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"}