sgl-project/sglang · error · ValueError
Failed to implicitly load LoRA adapter {lora_path}: {load_re
Error message
Failed to implicitly load LoRA adapter {lora_path}: {load_result.error_message} What it means
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.
Source
Thrown at python/sglang/srt/managers/tokenizer_manager.py:3378
raise ValueError(
f"Got LoRA adapter that has never been loaded: {lora_path}\n"
f"All loaded adapters: {self.lora_ref_cache.keys()}."
)
logger.info(f"Reloading evicted adapter: {lora_path}")
new_lora_ref = self.lora_ref_cache[lora_path]
load_result = await self.load_lora_adapter(
LoadLoRAAdapterReqInput(
lora_name=new_lora_ref.lora_name,
lora_path=new_lora_ref.lora_path,
pinned=new_lora_ref.pinned,
)
)
if (
not load_result.success
and "already loaded" not in load_result.error_message
):
raise ValueError(
f"Failed to implicitly load LoRA adapter {lora_path}: {load_result.error_message}"
)
# Look up the LoRA ID from the registry and start tracking ongoing LoRA requests.
obj.lora_id = await self.lora_registry.acquire(obj.lora_path)
# Propagate lora_id to any sub-objects already cached by __getitem__.
for i, sub_obj in obj.__dict__.get("_sub_obj_cache", {}).items():
sub_obj.lora_id = (
obj.lora_id[i] if isinstance(obj.lora_id, list) else obj.lora_id
)
def _init_req_state(
self,
obj: Union[GenerateReqInput, EmbeddingReqInput],
request: Optional[fastapi.Request] = None,
):
created_time = obj.received_time
View on GitHub (pinned to 0132848349)
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
Defensive patterns
Strategy: try-catch
Validate before calling
import os
for name, path in lora_paths.items():
assert os.path.isdir(path) and os.path.exists(os.path.join(path, 'adapter_config.json')), path Try / catch
try:
out = await engine.generate(prompt, lora_path=p)
except ValueError as e:
if "Failed to implicitly load LoRA adapter" in str(e):
log.error("adapter load failed: %s", e); alert_ops(e)
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- LoRA batch_info must provide max_len or seg_lens.
- LoRA batch_info must provide max_len or seg_lens.
- Initialization failed. Please see the error messages above.
- lora_nickname cannot be empty
- Failed to set LoRA adapter: {str(e)}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/a97719f8a25aa0c8.
Report an issue: GitHub.