sgl-project/sglang · error · ValueError
Dit target weight name {target_name} already exists in lora_
Error message
Dit target weight name {target_name} already exists in lora_adapters[{lora_nickname}] What it means
load_lora_adapter stores LoRA B weights keyed by target parameter name inside lora_adapters[nickname]; if two source entries in the checkpoint map to the same target_name (after SwiGLU fc1 name swapping), the second insert is rejected to avoid silently overwriting weights.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/lora/pipeline.py:914
if merge_index is not None:
to_merge_params[target_name][merge_index] = weight
# A/B of one fused layer must be laid out together (GQA B cannot stack).
if target_name.endswith((".lora_A", ".lora_B")):
continue
if len(to_merge_params[target_name]) == num_params_to_merge:
sorted_tensors = [
to_merge_params[target_name][i]
for i in range(num_params_to_merge)
]
# Use stack instead of cat because it needs to be compatible with TP.
weight = torch.stack(sorted_tensors, dim=0)
del to_merge_params[target_name]
else:
continue
weight = _swap_peft_swiglu_fc1_lora_b(name, target_name, weight)
if target_name in self.lora_adapters[lora_nickname]:
raise ValueError(
f"Dit target weight name {target_name} already exists in lora_adapters[{lora_nickname}]"
)
self.lora_adapters[lora_nickname][target_name] = weight.to(self.device)
_store_fused_lora_groups(
self.lora_adapters[lora_nickname],
to_merge_params,
adapter_lora_alpha,
self.device,
)
transformer = self.modules["transformer"]
if isinstance(transformer, BaseDiT):
self.lora_adapters[lora_nickname] = transformer.prepare_lora_adapter(
self.lora_adapters[lora_nickname]
)
self.loaded_adapter_paths[lora_nickname] = lora_path
self.loaded_adapter_alphas[lora_nickname] = adapter_lora_alphaView on GitHub (pinned to 0132848349)
Solutions
- Inspect the checkpoint keys (safetensors index) and remove the duplicate entry
- Re-export the LoRA adapter from the original training framework
- If this is a pipeline bug for your model arch, report it with the checkpoint key list
Defensive patterns
Strategy: validation
Validate before calling
from safetensors import safe_open
with safe_open(path, framework='pt') as f:
keys = list(f.keys())
assert len(keys) == len(set(keys)) and len(keys) <= expected_param_count Try / catch
try:
pipeline.set_lora(...)
except ValueError as e:
if 'already exists in lora_adapters' in str(e): log_checkpoint_issue(path) Prevention
- Only load adapters exported from the supported PEFT/training flow
- Keep a registry of known-good checkpoint hashes
When it happens
Trigger: A LoRA checkpoint containing duplicate/aliased weight names, e.g. both the original and _swap_peft_swiglu_fc1_lora_b-renamed variants of the same fc1 lora_b tensor; loading such an adapter via set_lora.
Common situations: Exporting a PEFT adapter for a SwiGLU model that duplicates gate/up names; converting checkpoints between naming conventions that produce collisions; corrupted or re-saved adapters.
Related errors
- scale_shift_table must have shape [9, D]
- LoRA batch_info must provide max_len or seg_lens.
- LoRA batch_info must provide max_len or seg_lens.
- lora_nickname cannot be empty
- Failed to set LoRA adapter: {str(e)}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/3ec1c942be02d72e.
Report an issue: GitHub.