{"record":{"id":"a97719f8a25aa0c8","repo":"sgl-project/sglang","slug":"failed-to-implicitly-load-lora-adapter-lora-path","errorCode":null,"errorMessage":"Failed to implicitly load LoRA adapter {lora_path}: {load_result.error_message}","messagePattern":"Failed to implicitly load LoRA adapter (.+?): (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/managers/tokenizer_manager.py","lineNumber":3378,"sourceCode":"                raise ValueError(\n                    f\"Got LoRA adapter that has never been loaded: {lora_path}\\n\"\n                    f\"All loaded adapters: {self.lora_ref_cache.keys()}.\"\n                )\n\n            logger.info(f\"Reloading evicted adapter: {lora_path}\")\n            new_lora_ref = self.lora_ref_cache[lora_path]\n            load_result = await self.load_lora_adapter(\n                LoadLoRAAdapterReqInput(\n                    lora_name=new_lora_ref.lora_name,\n                    lora_path=new_lora_ref.lora_path,\n                    pinned=new_lora_ref.pinned,\n                )\n            )\n            if (\n                not load_result.success\n                and \"already loaded\" not in load_result.error_message\n            ):\n                raise ValueError(\n                    f\"Failed to implicitly load LoRA adapter {lora_path}: {load_result.error_message}\"\n                )\n\n        # Look up the LoRA ID from the registry and start tracking ongoing LoRA requests.\n        obj.lora_id = await self.lora_registry.acquire(obj.lora_path)\n        # Propagate lora_id to any sub-objects already cached by __getitem__.\n        for i, sub_obj in obj.__dict__.get(\"_sub_obj_cache\", {}).items():\n            sub_obj.lora_id = (\n                obj.lora_id[i] if isinstance(obj.lora_id, list) else obj.lora_id\n            )\n\n    def _init_req_state(\n        self,\n        obj: Union[GenerateReqInput, EmbeddingReqInput],\n        request: Optional[fastapi.Request] = None,\n    ):\n        created_time = obj.received_time\n","sourceCodeStart":3360,"sourceCodeEnd":3396,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/managers/tokenizer_manager.py#L3360-L3396","documentation":"The server attempted an implicit load of a requested LoRA adapter and the load result reported failure (other than 'already loaded'). The tokenizer manager surfaces the underlying worker error message, e.g. missing files, incompatible rank/target modules, or OOM during weight load.","triggerScenarios":"Requesting lora_path that triggers implicit load while the adapter directory is missing, has an incompatible architecture (rank > max_lora_rank, unsupported target modules), or loading exhausts GPU memory.","commonSituations":"Wrong adapter path in --lora-paths or request; adapter trained on a different base model; --max-lora-rank too small; GPU memory exhausted by too many loaded adapters.","solutions":["Check the appended load_result.error_message for the root cause (missing file, rank mismatch, OOM)","Verify the adapter path exists and matches the base model, then reload via /load_lora_adapter","Increase --max-lora-rank / free GPU memory / reduce concurrently loaded adapters","Fix the path in --lora-paths and restart the server"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import os\nfor name, path in lora_paths.items():\n    assert os.path.isdir(path) and os.path.exists(os.path.join(path, 'adapter_config.json')), path","typeGuard":null,"tryCatchPattern":"try:\n    out = await engine.generate(prompt, lora_path=p)\nexcept ValueError as e:\n    if \"Failed to implicitly load LoRA adapter\" in str(e):\n        log.error(\"adapter load failed: %s\", e); alert_ops(e)\n    raise","preventionTips":["Validate adapter paths and adapter_config.json before server start","Match adapter base model and target modules with the served model","Set --max-lora-rank >= max adapter rank; load-test adapter memory footprint"],"tags":["lora","adapter-load","oom","incompatible-weights"],"backgroundTag":"model-weights-load-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}