sgl-project/sglang · error · ValueError
--prefill-decode-interval must be non-negative.
Error message
--prefill-decode-interval must be non-negative.
What it means
Raised by _validate_prefill_decode_interval when --prefill-decode-interval is negative. The interval controls how often the scheduler alternates between prefill and decode; negative intervals are invalid (0 means interleave every step).
Source
Thrown at python/sglang/srt/server_args.py:9567
def _handle_asr_validation(self):
"""Validate transcription/ASR-specific server args."""
cfg = resolving_view(self)
if cfg.asr_max_buffer_seconds <= 0:
raise ValueError(
f"--asr-max-buffer-seconds must be positive "
f"(got {cfg.asr_max_buffer_seconds})."
)
if cfg.asr_max_concurrent_sessions <= 0:
raise ValueError(
f"--asr-max-concurrent-sessions must be positive "
f"(got {cfg.asr_max_concurrent_sessions})."
)
def _validate_prefill_decode_interval(self):
cfg = resolving_view(self)
if cfg.prefill_decode_interval < 0:
raise ValueError("--prefill-decode-interval must be non-negative.")
def _handle_other_validations(self):
cfg = resolving_view(self)
if cfg.default_chat_template_kwargs is not None and not isinstance(
cfg.default_chat_template_kwargs, dict
):
raise ValueError(
"--default-chat-template-kwargs must decode to a JSON object"
)
# Handle optimistic prefill validation
if cfg.optimistic_prefill_attempts > 0 and cfg.disaggregation_mode == "prefill":
if cfg.pp_size > 1:
logger.warning("Optimistic prefill does not support pp_size > 1")
self._declare(
"_handle_other_validations",
optimistic_prefill_attempts=0,
)View on GitHub (pinned to 0132848349)
Solutions
- Use 0 or a positive value; use a large value (e.g. 1000000) to effectively disable interleaving
- Check for sign errors in generated launch commands
Example fix
# before --prefill-decode-interval -1 # after --prefill-decode-interval 0
Defensive patterns
Strategy: validation
Validate before calling
if args.prefill_decode_interval is not None and args.prefill_decode_interval < 0:
raise SystemExit('prefill_decode_interval must be >= 0') Prevention
- Use 0 or a large sentinel to alter interleaving, never negative values
- Add range assertions for scheduler knobs in config templates
When it happens
Trigger: Launching with a negative --prefill-decode-interval value.
Common situations: Trying to 'disable' the alternation with -1 instead of a large value; sign typos in scripted configs.
Related errors
- Decode context parallel size (--dcp-size / --decode-context-
- --mamba-max-states-per-path must be -1 (unlimited) or a posi
- --swa-full-tokens-ratio should be in range (0, 1.0].
- --asr-max-buffer-seconds must be positive (got {cfg.asr_max_
- --asr-max-concurrent-sessions must be positive (got {cfg.asr
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/a75ab1439b7fa6c4.
Report an issue: GitHub.