{"record":{"id":"a75ab1439b7fa6c4","repo":"sgl-project/sglang","slug":"prefill-decode-interval-must-be-non-negative","errorCode":null,"errorMessage":"--prefill-decode-interval must be non-negative.","messagePattern":"--prefill-decode-interval must be non-negative\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":9567,"sourceCode":"\n    def _handle_asr_validation(self):\n        \"\"\"Validate transcription/ASR-specific server args.\"\"\"\n        cfg = resolving_view(self)\n        if cfg.asr_max_buffer_seconds <= 0:\n            raise ValueError(\n                f\"--asr-max-buffer-seconds must be positive \"\n                f\"(got {cfg.asr_max_buffer_seconds}).\"\n            )\n        if cfg.asr_max_concurrent_sessions <= 0:\n            raise ValueError(\n                f\"--asr-max-concurrent-sessions must be positive \"\n                f\"(got {cfg.asr_max_concurrent_sessions}).\"\n            )\n\n    def _validate_prefill_decode_interval(self):\n        cfg = resolving_view(self)\n        if cfg.prefill_decode_interval < 0:\n            raise ValueError(\"--prefill-decode-interval must be non-negative.\")\n\n    def _handle_other_validations(self):\n        cfg = resolving_view(self)\n        if cfg.default_chat_template_kwargs is not None and not isinstance(\n            cfg.default_chat_template_kwargs, dict\n        ):\n            raise ValueError(\n                \"--default-chat-template-kwargs must decode to a JSON object\"\n            )\n\n        # Handle optimistic prefill validation\n        if cfg.optimistic_prefill_attempts > 0 and cfg.disaggregation_mode == \"prefill\":\n            if cfg.pp_size > 1:\n                logger.warning(\"Optimistic prefill does not support pp_size > 1\")\n                self._declare(\n                    \"_handle_other_validations\",\n                    optimistic_prefill_attempts=0,\n                )","sourceCodeStart":9549,"sourceCodeEnd":9585,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L9549-L9585","documentation":"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).","triggerScenarios":"Launching with a negative --prefill-decode-interval value.","commonSituations":"Trying to 'disable' the alternation with -1 instead of a large value; sign typos in scripted configs.","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"],"exampleFix":"# before\n--prefill-decode-interval -1\n# after\n--prefill-decode-interval 0","handlingStrategy":"validation","validationCode":"if args.prefill_decode_interval is not None and args.prefill_decode_interval < 0:\n    raise SystemExit('prefill_decode_interval must be >= 0')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use 0 or a large sentinel to alter interleaving, never negative values","Add range assertions for scheduler knobs in config templates"],"tags":["sglang","scheduler","prefill-decode","server-args","validation"],"backgroundTag":"config-value-out-of-range","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}