{"record":{"id":"3687deec70850c5a","repo":"sgl-project/sglang","slug":"warmup-num-frames-must-be-a-positive-integer","errorCode":null,"errorMessage":"--warmup-num-frames must be a positive integer.","messagePattern":"--warmup-num-frames must be a positive integer\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/server_args/server_args.py","lineNumber":1167,"sourceCode":"            fallback_keys = [key]\n            if key.endswith(\"_2\"):\n                # Secondary two-stage components inherit the base component\n                # backend unless explicitly overridden.\n                fallback_keys.append(key[:-2])\n            for backend_key in fallback_keys:\n                backend = self.component_attention_backends.get(backend_key)\n                if backend is not None:\n                    return AttentionBackendEnum[backend.upper()], backend_key\n        return None, None\n\n    def _adjust_warmup(self):\n        if self.warmup_mode is not None and self.warmup_mode not in WARMUP_MODES:\n            raise ValueError(\n                f\"Invalid --warmup-mode {self.warmup_mode!r}; \"\n                f\"expected one of {WARMUP_MODES}.\"\n            )\n        if self.warmup_num_frames is not None and self.warmup_num_frames <= 0:\n            raise ValueError(\"--warmup-num-frames must be a positive integer.\")\n\n        if self.enable_torch_compile and self.warmup_mode is None:\n            self.warmup_mode = \"server\"\n            logger.info(\n                \"Automatically enabled server warmup for torch.compile so first \"\n                \"real requests do not pay compile latency. Set --warmup-mode off \"\n                \"to disable this behavior.\"\n            )\n\n        # Explicit warmup shapes need a request path unless an existing server\n        # default already supplies the synthetic startup request.\n        if (\n            self.warmup_resolutions is not None or self.warmup_num_frames is not None\n        ) and self.warmup_mode in (None, \"off\"):\n            self.warmup_mode = \"request\"\n\n        # BCG captures every graph during a synthetic warmup forward at startup\n        # so serving never records a fresh graph.","sourceCodeStart":1149,"sourceCodeEnd":1185,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/server_args/server_args.py#L1149-L1185","documentation":"--warmup-num-frames, when provided, must be a positive integer (> 0). Zero or negative values are rejected in _adjust_warmup because warmup must run at least one frame.","triggerScenarios":"Passing --warmup-num-frames 0 (sometimes intended as 'disable') or a negative number.","commonSituations":"Trying to disable warmup by setting frames to 0 instead of --warmup-mode off; env-var or config defaulting to 0.","solutions":["Use --warmup-mode off to disable warmup entirely","Set a positive value, e.g. --warmup-num-frames 4","Check config templates that default this field to 0"],"exampleFix":"# before\n--warmup-mode server --warmup-num-frames 0\n# after\n--warmup-mode off","handlingStrategy":"validation","validationCode":"assert warmup_num_frames is None or warmup_num_frames > 0","typeGuard":"def valid_frame_count(n) -> bool:\n    return n is None or (isinstance(n, int) and n > 0)","tryCatchPattern":null,"preventionTips":["Don't use 0 frames to disable warmup; use warmup-mode off","Sanitize numeric env vars"],"tags":["config","cli","warmup","validation"],"backgroundTag":"out-of-range-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}