{"record":{"id":"839af44544dde732","repo":"sgl-project/sglang","slug":"failed-to-set-lora-adapter-str-e","errorCode":null,"errorMessage":"Failed to set LoRA adapter: {str(e)}","messagePattern":"Failed to set LoRA adapter: (.+?)","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/core/server_api.py","lineNumber":496,"sourceCode":"            \"lora_nickname\": lora_nickname,\n            \"target\": target,\n        }\n\n        # Add optional lora_path if provided\n        if lora_path:\n            payload[\"lora_path\"] = lora_path\n\n        try:\n            response = requests.post(\n                f\"{self.base_url}/set_lora\",\n                json=payload,\n                headers=self.headers,\n                timeout=30,\n            )\n            response.raise_for_status()\n            return response.json()\n        except requests.exceptions.RequestException as e:\n            raise RuntimeError(f\"Failed to set LoRA adapter: {str(e)}\")\n\n    def unset_lora(\n        self,\n        target: str = \"all\",\n    ) -> Dict[str, Any]:\n        \"\"\"\n        Unset (unmerge) LoRA weights from the base model.\n\n        Args:\n            target: same as set_lora\n\n        Returns:\n            Dictionary containing the API response with status and message\n        \"\"\"\n        # Prepare request payload\n        payload: Dict[str, Any] = {\n            \"target\": target,\n        }","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/core/server_api.py#L478-L514","documentation":"RuntimeError wrapper from set_lora when the POST to the LoRA endpoint fails (connection error or non-2xx status within a 30s timeout). The adapter was not applied.","triggerScenarios":"Server down/unreachable, unknown lora_nickname rejected with 4xx, or the LoRA endpoint returning 500 while loading the adapter.","commonSituations":"Nickname not registered server-side; LoRA weights missing on the server; endpoint absent in older server versions; request exceeding 30s while weights load.","solutions":["Check the embedded status: 404 = nickname unknown or endpoint missing, 500 = loading failure.","Verify the nickname against the server's LoRA listing.","Increase the 30s timeout if large adapters load slowly.","Check server logs for weight-loading errors."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    api.set_lora(nickname, target='all')\nexcept RuntimeError as e:\n    if '404' in str(e): raise ValueError(f'unknown LoRA {nickname}')\n    time.sleep(2); api.set_lora(nickname, target='all')","preventionTips":["Verify nickname is registered server-side before calling.","Allow longer timeout for big adapters.","Check server logs on persistent 5xx."],"tags":["network","http","lora","sgldiffusion"],"backgroundTag":"http-request-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}