{"record":{"id":"0165b73378193442","repo":"sgl-project/sglang","slug":"failed-to-unset-lora-adapter-str-e","errorCode":null,"errorMessage":"Failed to unset LoRA adapter: {str(e)}","messagePattern":"Failed to unset LoRA adapter: (.+?)","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"warning","filePath":"python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/core/server_api.py","lineNumber":526,"sourceCode":"        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        }\n\n        try:\n            response = requests.post(\n                f\"{self.base_url}/unmerge_lora_weights\",\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 unset LoRA adapter: {str(e)}\")\n\n\nif __name__ == \"__main__\":\n    api = SGLDiffusionServerAPI(\n        base_url=\"http://localhost:30010/v1\", api_key=\"sk-proj-1234567890\"\n    )\n    model_info = api.get_model_info()\n    print(api.get_model_info())\n    if model_info.get(\"task_type\") == \"T2V\" or model_info.get(\"task_type\") == \"I2V\":\n        print(\n            api.generate_video(\n                prompt=\"A calico cat playing a piano on stage\",\n                num_inference_steps=1,\n                size=\"480x480\",\n            )\n        )\n    else:\n        print(","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/core/server_api.py#L508-L544","documentation":"RuntimeError wrapper from unset_lora when the POST to remove LoRA adapters fails at the HTTP level (unreachable server, non-2xx status, 30s timeout). Nothing was unset.","triggerScenarios":"Calling unset_lora() while the server is down, the endpoint returns an error (e.g. no adapter currently set), or the request times out.","commonSituations":"Calling unset on an already-clean server; endpoint missing in the deployed server version; transient network blip.","solutions":["Verify server reachability first.","If the server says no adapter is set, treat it as success instead of an error.","Retry once for transient network failures.","Match client and server versions so the endpoint exists."],"exampleFix":"// before\napi.unset_lora()\n// after\ntry:\n    api.unset_lora()\nexcept RuntimeError as e:\n    if \"no adapter\" in str(e).lower():\n        pass  # already unset\n    else:\n        raise","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    api.unset_lora()\nexcept RuntimeError as e:\n    if 'not set' in str(e).lower() or 'no adapter' in str(e).lower():\n        pass  # already clean\n    else:\n        raise","preventionTips":["Treat 'nothing to unset' as success.","Retry once for transient network errors.","Keep server version in sync with the client."],"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"}