sgl-project/sglang · error · ValueError

The following requested LoRA adapters are not loaded: {name}

Error message

The following requested LoRA adapters are not loaded: {name}\nLoaded adapters: {self._registry.keys()}.

What it means

Raised by LoRARegistry._lookup (used by acquire) when a request references a LoRA adapter name that is not in the registry. It happens per-request when routing a generate call with a lora_name that was never loaded or was unloaded.

Source

Thrown at python/sglang/srt/lora/lora_registry.py:138

                    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:
                raise ValueError(
                    f"The following requested LoRA adapters are not loaded: {name}\n"
                    f"Loaded adapters: {self._registry.keys()}."
                )
            self._registry.move_to_end(name)
            return lora_ref.lora_id

        if isinstance(lora_name, str):
            async with self._registry_lock.writer_lock:
                lora_id = _lookup(lora_name)

            await self._counters[lora_id].increment(notify_all=False)
            return lora_id
        elif isinstance(lora_name, list):
            async with self._registry_lock.writer_lock:
                lora_ids = [_lookup(name) for name in lora_name]

            # Increment the counters only after all IDs are looked up.
            await asyncio.gather(

View on GitHub (pinned to 0132848349)

Solutions

  1. Load the adapter via /load_lora_adapter before sending requests that reference it
  2. Fix the name in the request to exactly match a loaded adapter (see the Loaded adapters list in the message)
  3. Add a pre-flight check of loaded adapters before dispatching traffic

Example fix

# before
resp = client.generate(prompt, sampling_params, lora_name='my-adptr')
# after
client.load_lora_adapter('my-adapter', path)
resp = client.generate(prompt, sampling_params, lora_name='my-adapter')
Defensive patterns

Strategy: validation

Validate before calling

loaded = set(registry._registry.keys())
if request.lora_name not in loaded:
    raise ValueError(f"lora '{request.lora_name}' not loaded; available: {sorted(loaded)}")

Type guard

def lora_is_loaded(registry, name: str) -> bool:
    return name in registry._registry

Try / catch

try:
    registry.acquire([name])
except ValueError as e:
    if 'not loaded' in str(e):
        load_then_retry(name)
    else:
        raise

Prevention

When it happens

Trigger: Sending a generation request whose lora_name parameter doesn't match any registry key (misspelled, unloaded, or loaded on a different server/worker); acquire() calls _lookup per name.

Common situations: Client requests referencing an adapter before loading it; adapter evicted/unloaded while requests in flight; multi-worker setups where only some ranks loaded the adapter.

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


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/fb8bd1d6b3e12d59. Report an issue: GitHub.