{"record":{"id":"980e5acc434cdc1b","repo":"sgl-project/sglang","slug":"bcg-text-buckets-must-contain-at-least-one-posit","errorCode":null,"errorMessage":"--bcg-text-buckets must contain at least one positive integer.","messagePattern":"--bcg-text-buckets must contain at least one positive integer\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/server_args/server_args.py","lineNumber":638,"sourceCode":"        # BCG graphs are captured per resolution and only replay for that exact\n        # latent shape, so the user must declare the resolutions up front. We\n        # capture every one of them at warmup; serving then never re-captures.\n        if not self.warmup_resolutions:\n            # No explicit resolutions: capture the model's default warmup\n            # resolution (derived by build_warmup_reqs) so\n            # --enable-breakable-cuda-graph works standalone. BCG graphs are\n            # resolution-specific; a request at any other resolution simply\n            # falls back to eager (the runner never re-captures at serving\n            # time). Pass --warmup-resolutions to capture additional shapes.\n            logger.info(\n                \"[Diffusion BCG] --warmup-resolutions unset; capturing the \"\n                \"model default warmup resolution. Requests at other \"\n                \"resolutions run eager.\"\n            )\n        if self.bcg_text_buckets is not None and not any(\n            int(b) > 0 for b in self.bcg_text_buckets\n        ):\n            raise ValueError(\n                \"--bcg-text-buckets must contain at least one positive integer.\"\n            )\n\n    def _adjust_breakable_cuda_graph_support(self):\n        if not self.enable_breakable_cuda_graph:\n            return\n\n        pipeline_config = getattr(self, \"pipeline_config\", None)\n        pipeline_config_name = type(pipeline_config).__name__\n        if (\n            pipeline_config_name in BREAKABLE_CUDA_GRAPH_SUPPORTED_PIPELINE_CONFIGS\n            and self._is_breakable_cuda_graph_supported_model()\n        ):\n            if not self.warmup_resolutions:\n                self._default_bcg_warmup_resolution()\n            return\n\n        logger.warning(","sourceCodeStart":620,"sourceCodeEnd":656,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/server_args/server_args.py#L620-L656","documentation":"When bcg_text_buckets is provided (not None), at least one bucket value must be a positive integer; a list of all zero/non-positive values fails _validate_breakable_cuda_graph.","triggerScenarios":"ServerArgs(bcg_text_buckets=[0, -1]) or a parsed bucket list that contains no value > 0 (e.g. env parsing produced zeros).","commonSituations":"Misconfigured CUDA graph text bucket list; copying a bucket spec where placeholder 0s were not replaced; sign errors when computing buckets programmatically.","solutions":["Include at least one positive integer in --bcg-text-buckets, e.g. [8192]","If you don't need custom buckets, pass None/omit the option"],"exampleFix":"# before\nServerArgs(..., bcg_text_buckets=[0])\n# after\nServerArgs(..., bcg_text_buckets=[4096, 8192])","handlingStrategy":"validation","validationCode":"buckets = cfg.get('bcg_text_buckets')\nif buckets is not None and not any(int(b) > 0 for b in buckets):\n    raise SystemExit('--bcg-text-buckets needs at least one positive integer')","typeGuard":"def valid_text_buckets(b) -> bool:\n    return b is None or any(isinstance(x, int) and x > 0 for x in b)","tryCatchPattern":null,"preventionTips":["Generate bucket lists from real profiled sequence lengths, all positive","Unit-test bucket config before deploying"],"tags":["cuda-graph","buckets","config-validation"],"backgroundTag":"invalid-config-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}