sgl-project/sglang · error · ValueError
Invalid target(s): {invalid_targets}. Valid targets: {self.V
Error message
Invalid target(s): {invalid_targets}. Valid targets: {self.VALID_TARGETS} What it means
set_lora validates each entry of targets against the pipeline class's VALID_TARGETS class attribute; unknown target module names are rejected before any weights are touched (deliberately before offload is disabled, to avoid OOM on constrained deployments).
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/lora/pipeline.py:966
Supports both single LoRA (backward compatible) and multiple LoRA adapters.
cache_merged re-homes merged weights to a file-backed store so they
stop costing anonymous host memory; pass it only for the startup
(static) adapter, where the merged combination is stable.
"""
merge_mode = self._resolve_lora_merge_mode(merge_weights, merge_mode)
# Normalize inputs to lists for multi-LoRA support
lora_nicknames, lora_paths, strengths, targets, lora_alphas = (
self._normalize_lora_params(
lora_nickname, lora_path, strength, target, lora_alpha
)
)
# Validate targets
invalid_targets = [t for t in targets if t not in self.VALID_TARGETS]
if invalid_targets:
raise ValueError(
f"Invalid target(s): {invalid_targets}. Valid targets: {self.VALID_TARGETS}"
)
# Checked before disabling offload, which materializes every layer: on a
# memory-constrained deployment that would OOM instead of returning the
# unsupported-LoRA error. Offloaded placeholders still carry the name.
self._reject_lora_on_packed_weights()
# Disable layerwise offload before convert_to_lora_layers to ensure weights are accessible
# This is critical because convert_to_lora_layers needs to save cpu_weight from actual weights,
# not from offloaded placeholder tensors
if not self.lora_initialized:
with self._temporarily_disable_offload(
target="all", use_module_names_only=True
):
self.convert_to_lora_layers()
# Check adapter presence and load missing adaptersView on GitHub (pinned to 0132848349)
Solutions
- Print pipeline.VALID_TARGETS and use one of those names
- Check the pipeline subclass matching your model — targets differ per architecture
- Fix typos like 'attention' vs 'attn'
Example fix
# before pipeline.set_lora(..., targets=['q_proj']) # after pipeline.set_lora(..., targets=['attn'])
Defensive patterns
Strategy: type-guard
Validate before calling
invalid = [t for t in targets if t not in pipeline.VALID_TARGETS]
assert not invalid, f'invalid targets {invalid}; valid: {pipeline.VALID_TARGETS}' Type guard
def valid_targets(pipeline, targets: list[str]) -> bool:
return all(t in pipeline.VALID_TARGETS for t in targets) Prevention
- Print VALID_TARGETS once at pipeline setup and assert config against it
When it happens
Trigger: Calling set_lora(targets=['attn']) or any module name not in e.g. {'attn', 'fc1', 'fc2', ...} for your pipeline class.
Common situations: Using target names from a different model family (LLM PEFT targets like 'q_proj' on a DiT pipeline); typo; new model version renamed layers without updating VALID_TARGETS.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Invalid LoRA merge mode: {merge_mode}. Valid modes: {LORA_ME
- lora_alpha must be a positive integer
- bad compress_ratio {compress_ratio}
- The requested FlashAttention forward configuration exceeds S
- flashinfer_sparse_mla supports only GLM DSA with FP8 KV cach
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/d3505a154afecae6.
Report an issue: GitHub.