sgl-project/sglang · critical · RuntimeError
Failed to load LoRA adapter {lora_ref.lora_name}: {result.er
Error message
Failed to load LoRA adapter {lora_ref.lora_name}: {result.error_message} What it means
Raised during LoRAManager.init_lora_adapters (called from init_state at startup) when an adapter listed in startup lora_paths fails to load and the internal _load_lora_adapter result reports success=False. It wraps the underlying error_message from the load attempt (weight conversion, file IO, config parse, etc.).
Source
Thrown at python/sglang/srt/lora/lora_manager.py:612
def init_lora_adapters(self, lora_paths: Optional[List[LoRARef]] = None):
# Configs of all active LoRA adapters, indexed by LoRA ID.
self.configs: Dict[str, LoRAConfig] = {}
# LoRA adapter weights cached in CPU memory, indexed by LoRA ID.
self.loras: Dict[str, LoRAAdapter] = {}
# Mapping from LoRA ID to LoRARef object.
self.lora_refs: Dict[str, LoRARef] = {}
# Count of pinned LoRA adapters.
self.num_pinned_loras: int = 0
if lora_paths:
for lora_ref in lora_paths:
result = self._load_lora_adapter(lora_ref)
if not result.success:
raise RuntimeError(
f"Failed to load LoRA adapter {lora_ref.lora_name}: {result.error_message}"
)
def _detect_shared_outer_loras(self) -> bool:
"""Auto-detect shared outer LoRA format from loaded adapter weights.
MoE adapters with shared outer experts store 3D tensors where
dim[0]=1 indicates weights shared across all experts, while
dim[0]=num_experts indicates per-expert weights.
Returns True if gate_up lora_A has expert_dim=1 (shared).
All loaded adapters that expose a 3D gate_up lora_A must agree;
mixed formats raise RuntimeError.
"""
shared_outer: Optional[bool] = None
for adapter_id, adapter in self.loras.items():
for layer in adapter.layers:
for name, weight in layer.weights.items():View on GitHub (pinned to 0132848349)
Solutions
- Check the wrapped result.error_message in the traceback to identify the root cause
- Verify the adapter path exists and contains a valid PEFT adapter (adapter_config.json + safetensors)
- Fix or remove the offending entry from --lora-paths and restart
- Confirm the adapter is plain LoRA (not DoRA) and its rank/targets match server flags
Defensive patterns
Strategy: try-catch
Validate before calling
import os
for name, path in lora_paths:
assert os.path.isdir(path) and os.path.exists(os.path.join(path, 'adapter_config.json')), f"bad lora path: {path}" Try / catch
try:
manager.init_lora_adapters(lora_paths)
except RuntimeError as e:
log.error("startup LoRA load failed: %s", e) # e carries the inner error_message
raise SystemExit(1) Prevention
- Validate every --lora-paths entry exists locally on all workers
- Test-load new adapters on a staging server before production startup
- Keep adapters in a stable PEFT format
When it happens
Trigger: Passing --lora-paths (or the equivalent lora_paths list) at server startup where at least one path is invalid, missing adapter_config.json/weights, or fails CUDA-side weight preparation, making result.success false.
Common situations: Typo in the adapter path in server args, an adapter saved in an unsupported format (DoRA, non-PEFT layout), or an OOM/corruption during weight loading at startup.
Related errors
- SGLANG_RUST_SERVER is not supported with the offline Engine
- Multi-node weight cache daemons (nnodes > 1) require --dist-
- Weight cache daemon for pp_rank={pp_rank} tp_rank={tp_rank}
- Weight cache daemon (pid={p.pid}) exited prematurely with co
- engine_info_bootstrap_port {bootstrap_port} is already in us
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/b35ec79cedd828ce.
Report an issue: GitHub.