sgl-project/sglang · warning · RuntimeError

Failed to unset LoRA adapter

Error message

Failed to unset LoRA adapter: {str(e)}

What it means

Error surfaced when unloading/deactivating a LoRA adapter fails on the backend; the underlying exception text is embedded. Usually follows an adapter that was only partially loaded or already evicted.

Solutions

  1. Verify server reachability first.
  2. If the server says no adapter is set, treat it as success instead of an error.
  3. Retry once for transient network failures.
  4. Match client and server versions so the endpoint exists.

Example fix

// before
api.unset_lora()
// after
try:
    api.unset_lora()
except RuntimeError as e:
    if "no adapter" in str(e).lower():
        pass  # already unset
    else:
        raise
Defensive patterns

Strategy: fallback

Try / catch

try:
    api.unset_lora()
except RuntimeError as e:
    if 'not set' in str(e).lower() or 'no adapter' in str(e).lower():
        pass  # already clean
    else:
        raise

Prevention

When it happens

Trigger: Calling unset_lora() while the server is down, the endpoint returns an error (e.g. no adapter currently set), or the request times out.

Common situations: Calling unset on an already-clean server; endpoint missing in the deployed server version; transient network blip.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/0165b73378193442. Report an issue: GitHub.

Appendix: source

Thrown at python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/core/server_api.py:526

        Returns:
            Dictionary containing the API response with status and message
        """
        # Prepare request payload
        payload: Dict[str, Any] = {
            "target": target,
        }

        try:
            response = requests.post(
                f"{self.base_url}/unmerge_lora_weights",
                json=payload,
                headers=self.headers,
                timeout=30,
            )
            response.raise_for_status()
            return response.json()
        except requests.exceptions.RequestException as e:
            raise RuntimeError(f"Failed to unset LoRA adapter: {str(e)}")


if __name__ == "__main__":
    api = SGLDiffusionServerAPI(
        base_url="http://localhost:30010/v1", api_key="sk-proj-1234567890"
    )
    model_info = api.get_model_info()
    print(api.get_model_info())
    if model_info.get("task_type") == "T2V" or model_info.get("task_type") == "I2V":
        print(
            api.generate_video(
                prompt="A calico cat playing a piano on stage",
                num_inference_steps=1,
                size="480x480",
            )
        )
    else:
        print(

View on GitHub (pinned to 0132848349)