sgl-project/sglang · error · ValueError
LoRA is not enabled. Please set `--enable-lora` to enable Lo
Error message
LoRA is not enabled. Please set `--enable-lora` to enable LoRA.
What it means
The /load_lora_adapter HTTP/control API refuses to load a LoRA adapter because the server was not started with --enable-lora, so no LoRA support is initialized.
Source
Thrown at python/sglang/srt/managers/tokenizer_control_mixin.py:613
# Initiate the actual unloading operation at the backend processes only after all
# ongoing requests using this LoRA adapter are finished.
await self.lora_registry.wait_for_unload(lora_id)
result = _merge_lora_update_results(
await self.update_lora_adapter_communicator(obj)
)
return result
async def load_lora_adapter(
self: TokenizerManager,
obj: LoadLoRAAdapterReqInput,
_: Optional[fastapi.Request] = None,
) -> LoadLoRAAdapterReqOutput:
self.auto_create_handle_loop()
try:
if not get_lora().enable_lora:
raise ValueError(
"LoRA is not enabled. Please set `--enable-lora` to enable LoRA."
)
assert (
get_parallel().dp_size == 1 or get_parallel().enable_dp_attention
), "dp_size must be 1 or dp attention must be enabled for dynamic lora loading"
logger.info(
"Start load Lora adapter. Lora name=%s, path=%s",
obj.lora_name,
obj.lora_path,
)
async with self.lora_update_lock:
# Generate new uniquely identifiable LoRARef object.
new_adapter = LoRARef(
lora_name=obj.lora_name,
lora_path=obj.lora_path,
pinned=obj.pinned,View on GitHub (pinned to 0132848349)
Solutions
- Relaunch the server with --enable-lora (and set --max-lora-rank/--lora-modules as needed)
- Verify get_lora().enable_lora in your runtime config before issuing the request
Example fix
# before python -m sglang.launch_server --model-path ... # after python -m sglang.launch_server --model-path ... --enable-lora --max-lora-rank 64
Defensive patterns
Strategy: validation
Validate before calling
resp = requests.get(server + '/get_server_info')
if not resp.json().get('enable_lora'):
skip_or_fail('server lacks --enable-lora') Try / catch
try:
await client.load_lora_adapter(req)
except ValueError as e:
if 'enable-lora' in str(e):
raise ConfigError('relaunch server with --enable-lora') from e
raise Prevention
- Bake --enable-lora into launch templates for LoRA-serving deployments
- Query server info before LoRA API calls
When it happens
Trigger: Calling load_lora_adapter on a server launched without --enable-lora (or with enable_lora false in runtime config).
Common situations: Forgetting the launch flag when adding dynamic LoRA loading to a serving stack; config presets that drop the flag.
Related errors
- PEFT adapter_config.json must contain a JSON object
- PEFT lora_alpha must be a positive integer
- LoRA adapter {lora_ref.lora_name} with rank {lora_config.r}
- Failed to load LoRA adapter {lora_ref.lora_name} as a pinned
- Streaming sessions are disabled. Please relaunch with --enab
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/98f852d56cb9b0d9.
Report an issue: GitHub.