sgl-project/sglang · error · ValueError
Got LoRA adapter that has never been loaded: {lora_path}\nAl
Error message
Got LoRA adapter that has never been loaded: {lora_path}\nAll loaded adapters: {self.lora_ref_cache.keys()}. What it means
During reload of dynamically-unloaded (evicted) adapters, a path was found in the unregistered set that has no entry in the tokenizer-side lora_ref_cache, meaning it was never registered/loaded on this node. This indicates registry/cache desynchronization, common after a worker restart or state reset.
Source
Thrown at python/sglang/srt/managers/tokenizer_manager.py:3360
if (
get_lora().max_loaded_loras is not None
and len(unique_lora_paths) > get_lora().max_loaded_loras
):
raise ValueError(
f"Received request with {len(unique_lora_paths)} unique loras requested "
f"but max loaded loras is {get_lora().max_loaded_loras}"
)
# Reload all existing LoRA adapters that have been dynamically unloaded
unregistered_loras = await self.lora_registry.get_unregistered_loras(
unique_lora_paths
)
for lora_path in unregistered_loras:
if lora_path is None:
continue
if lora_path not in self.lora_ref_cache:
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(View on GitHub (pinned to 0132848349)
Solutions
- Restart the service so registry and ref-cache are rebuilt from --lora-paths
- Explicitly reload the adapter via /load_lora_adapter before retrying the request
- Report/upstream if reproducible — the caches should not desync; include adapter paths and logs
Defensive patterns
Strategy: retry
Validate before calling
loaded = set(get_loaded_lora_adapters()) # via /get_server_info or registry
missing = [p for p in requested_paths if p and p not in loaded]
if missing:
await load_adapters(missing) # /load_lora_adapter Try / catch
try:
out = await engine.generate(prompt, lora_path=p)
except ValueError as e:
if "never been loaded" in str(e):
await load_lora_adapter(p)
out = await engine.generate(prompt, lora_path=p) # one retry
else:
raise Prevention
- Preload adapters explicitly instead of relying on implicit reload after eviction
- Watch logs for 'Reloading evicted adapter' to detect thrash near the limit
- Restart the server after worker failover before resending adapter requests
When it happens
Trigger: A request references a previously loaded but evicted adapter; get_unregistered_loras returns it, yet lora_ref_cache has no key for that path (cache cleared, cross-process mismatch, or adapter memory dropped by a different mechanism).
Common situations: Scheduler restart or failover losing tokenizer-side ref-cache state; adapters unloaded via internal eviction while cache invalidation raced; version upgrades changing eviction bookkeeping.
Related errors
- Resolved LoRA weight {selected_file!r} was not downloaded to
- LoRA pinned weight cache key collision for {cache_key!r}: ca
- Didn't find any LoRA adapters when trying to evict LRU LoRA
- Error while unloading LRU LoRA adapter '{lru_lora_name}': {u
- LoRA batch_info must provide max_len or seg_lens.
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/f1f3c0437e9660d7.
Report an issue: GitHub.