{"record":{"id":"ce8844815b603fc9","repo":"sgl-project/sglang","slug":"lora-alpha-must-be-a-positive-integer","errorCode":null,"errorMessage":"lora_alpha must be a positive integer","messagePattern":"lora_alpha 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":582,"sourceCode":"        self._adjust_warmup()\n        self._adjust_network_ports()\n        # adjust parallelism before attention backend\n        self._adjust_parallelism()\n        self._adjust_attention_backend()\n        self._adjust_platform_specific()\n        self._adjust_layerwise_offload_components()\n        self._adjust_autocast()\n        auto_tuner.finalize_auto_flags()\n        self.adjust_pipeline_config()\n\n    def _validate_parameters(self):\n        \"\"\"check consistency and raise errors for invalid configs\"\"\"\n        self._validate_scheduler_rpc_timeout()\n        self._validate_pipeline()\n        self._validate_offload()\n        self._validate_direct_gpu_weight_loading()\n        if self.lora_alpha is not None and self.lora_alpha <= 0:\n            raise ValueError(\"lora_alpha must be a positive integer\")\n        if not current_platform.is_cpu():\n            self._validate_parallelism()\n        self._validate_cfg_parallel()\n        self._validate_batching()\n        self._validate_breakable_cuda_graph()\n        self.pipeline_config.validate_server_args(self)\n\n    def _validate_scheduler_rpc_timeout(self) -> None:\n        timeout = self.scheduler_rpc_timeout\n        if timeout is None:\n            return\n        if (\n            not isinstance(timeout, int)\n            or isinstance(timeout, bool)\n            or not 0 < timeout <= MAX_SCHEDULER_RPC_TIMEOUT_S\n        ):\n            raise ValueError(\n                \"scheduler_rpc_timeout must be None or an integer between \"","sourceCodeStart":564,"sourceCodeEnd":600,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/server_args/server_args.py#L564-L600","documentation":"Validation in _validate_parameters: lora_alpha, when set, must be a positive integer (> 0). It is checked after scheduler/pipeline/offload validation and before parallelism checks.","triggerScenarios":"ServerArgs(dataclass) constructed with lora_alpha=0 or a negative value, then __post_init__ runs _validate_parameters. Also any path that passes a None-check but stores 0 (e.g. int(os.getenv(...)) defaulting to 0).","commonSituations":"Setting LoRA alpha to 0 intending 'disabled' instead of None; env var parsing that yields 0; copy-paste from a config where alpha was unset.","solutions":["Set lora_alpha=None (or omit it) to disable LoRA","Use a positive integer such as 16 or 32 matching your LoRA training config"],"exampleFix":"# before\nServerArgs(..., lora_alpha=0)\n# after\nServerArgs(..., lora_alpha=None)","handlingStrategy":"validation","validationCode":"if cfg.get('lora_alpha') is not None and (not isinstance(cfg['lora_alpha'], int) or cfg['lora_alpha'] <= 0):\n    cfg['lora_alpha'] = None  # or fail fast with a clear config error","typeGuard":"def valid_lora_alpha(v) -> bool:\n    return v is None or (isinstance(v, int) and not isinstance(v, bool) and v > 0)","tryCatchPattern":null,"preventionTips":["Treat 0 as 'unset' when parsing env/config and normalize to None","Schema-validate config files before launching the server"],"tags":["lora","config-validation","server-args"],"backgroundTag":"invalid-config-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}