sgl-project/sglang · error · ValueError
LoRA with name {lora_name} does not exist. Loaded LoRAs: {se
Error message
LoRA with name {lora_name} does not exist. Loaded LoRAs: {self._registry.keys()} What it means
Raised by LoRARegistry.unregister when asked to unregister a LoRA name that is not present in the registry. The registry is the source of truth for loaded adapters; attempts to remove a never-loaded, already-unregistered, or misspelled adapter fail here.
Source
Thrown at python/sglang/srt/lora/lora_registry.py:119
Register a new LoRARef object in the registry.
Args:
lora_ref (LoRARef): The LoRARef object to register.
"""
async with self._registry_lock.writer_lock:
self._register_adapter(lora_ref)
async def unregister(self, lora_name: str) -> str:
"""
Unregister a LoRARef object from the registry and returns the removed LoRA ID.
Args:
lora_name (str): The name of the LoRA model to unregister.
"""
async with self._registry_lock.writer_lock:
lora_ref = self._registry.get(lora_name, None)
if lora_ref is None:
raise ValueError(
f"LoRA with name {lora_name} does not exist. Loaded LoRAs: {self._registry.keys()}"
)
del self._registry[lora_name]
return lora_ref.lora_id
async def acquire(self, lora_name: Union[str, List[str]]) -> Union[str, List[str]]:
"""
Queries registry for LoRA IDs based on LoRA names and start tracking the usage of the corresponding LoRA adapters
by incrementing its counter.
"""
def _lookup(name: str) -> str:
if name is None:
return None
lora_ref = self._registry.get(name, None)
if lora_ref is None:View on GitHub (pinned to 0132848349)
Solutions
- Check the loaded adapter list in the error message and use the exact name
- Guard the unload call with a contains/lookup check first
- Avoid retrying unload requests after success
Example fix
# before
await registry.unregister('adptr') # typo
# after
if 'adptr' in registry._registry:
await registry.unregister('adptr')
# or simply use the exact name: 'adapter1' Defensive patterns
Strategy: validation
Validate before calling
if lora_name not in registry._registry:
raise KeyError(f'cannot unload unknown adapter {lora_name}; loaded: {list(registry._registry)}') Try / catch
try:
await registry.unregister(lora_name)
except ValueError:
pass # already unloaded — treat as success for idempotent cleanup Prevention
- Make unload paths idempotent (tolerate already-removed)
- Copy names exactly from the load response
When it happens
Trigger: Calling the unregister API (e.g. /unload_lora_adapter) with a name absent from self._registry — after a prior unload, a typo, or before any load.
Common situations: Double-unload due to a retried HTTP request; client-side name mismatch with the adapter actually loaded; cleanup code that assumes an adapter exists.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- The following requested LoRA adapters are not loaded: {name}
- LoRA with name {lora_ref.lora_name} already exists. Loaded L
- No kernels registered for op {op!r}
- No '{backend.value}' backend registered for op {op!r}
- DSA indexer weights_proj LoRA is incompatible with piecewise
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/b78b1d63e7b9dd8a.
Report an issue: GitHub.