{"record":{"id":"ca3cc3f6534389ca","repo":"sgl-project/sglang","slug":"failure-msg-error-msg","errorCode":null,"errorMessage":"{failure_msg}: {error_msg}","messagePattern":"\\{failure_msg\\}: \\{error_msg\\}","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/entrypoints/diffusion_generator.py","lineNumber":568,"sourceCode":"            raise RuntimeError(\n                f\"Expected {request_count} outputs, got {output_count} from scheduler\"\n            )\n\n    def _send_to_scheduler_and_wait_for_response(self, batch: list[Req]) -> OutputBatch:\n        \"\"\"\n        Sends a request to the scheduler and waits for a response.\n        \"\"\"\n        return sync_scheduler_client.forward(batch)\n\n    # LoRA\n    def _send_lora_request(self, req: Any, success_msg: str, failure_msg: str):\n        response = sync_scheduler_client.forward(req)\n        if response.error is None:\n            logger.info(success_msg)\n            return response\n        else:\n            error_msg = response.error\n            raise RuntimeError(f\"{failure_msg}: {error_msg}\")\n\n    def set_lora(\n        self,\n        lora_nickname: Union[str, List[str]],\n        lora_path: Union[str, None, List[Union[str, None]]] = None,\n        target: Union[str, List[str]] = \"all\",\n        strength: Union[float, List[float]] = 1.0,\n        merge_mode: str | None = None,\n        lora_alpha: Optional[Union[int, List[Optional[int]]]] = None,\n    ) -> None:\n        \"\"\"\n        Set LoRA adapter(s) for the specified transformer(s).\n        Supports both single LoRA (backward compatible) and multiple LoRA adapters.\n\n        Args:\n            lora_nickname: The nickname(s) of the adapter(s). Can be a string or a list of strings.\n            lora_path: Path(s) to the LoRA adapter(s). Can be a string, None, or a list of strings/None.\n            target: Which transformer(s) to apply the LoRA to. Can be a string or a list of strings.","sourceCodeStart":550,"sourceCodeEnd":586,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/entrypoints/diffusion_generator.py#L550-L586","documentation":"A LoRA management call (set_lora, merge_lora_weights, unmerge_lora_weights, list_loras) sent a synchronous control request to the scheduler via sync_scheduler_client.forward, and the scheduler responded with an error. The failure message is prefixed with a per-operation label (failure_msg) and the scheduler's error string appended.","triggerScenarios":"set_lora('nick','/bad/path') where the adapter fails to load or the path does not exist; merging weights for a nickname that was never registered; LoRA rank/shape incompatible with the base model; scheduler busy or in a state that rejects LoRA ops.","commonSituations":"Wrong or missing adapter path; LoRA trained against a different base model; calling merge before set; concurrent LoRA operations racing on the scheduler; adapter file corrupted or incomplete download.","solutions":["Verify the LoRA adapter path exists and was trained for this exact base model","Ensure set_lora succeeded (and list_loras shows the nickname) before merge/unmerge","Read the suffix of the message — it is the scheduler's specific error (load failure, unknown nickname, etc.)","Retry after the scheduler is idle; avoid concurrent LoRA control calls"],"exampleFix":"# before\ngenerator.set_lora(\"my-lora\", \"/tmp/lora\")  # typo'd/incomplete path\ngenerator.merge_lora_weights(\"my-lora\")\n# after\nfrom pathlib import Path\nadapter = Path(\"/models/my-lora\").resolve()\nassert (adapter / \"adapter_config.json\").exists()\ngenerator.set_lora(\"my-lora\", str(adapter))\ngenerator.merge_lora_weights(\"my-lora\")","handlingStrategy":"try-catch","validationCode":"from pathlib import Path\ndef lora_ready(nickname, path):\n    p = Path(path)\n    return nickname and (p / \"adapter_config.json\").exists()","typeGuard":null,"tryCatchPattern":"try:\n    generator.set_lora(nick, path)\nexcept RuntimeError as e:\n    logger.error(\"set_lora failed: %s\", e)  # message contains scheduler-side cause\n    # fall back to baseline model, do not merge","preventionTips":["Verify adapter paths and base-model compatibility before set_lora","Call list_loras to confirm registration before merge/unmerge","Serialize LoRA control calls; avoid issuing them mid-generation"],"tags":["lora","scheduler","adapter-loading","runtime-error"],"backgroundTag":"lora-adapter-load-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}