sgl-project/sglang · error · ValueError
SGLang does not recognize target_modules='{config.target_mod
Error message
SGLang does not recognize target_modules='{config.target_modules}'. Please use a list of module name suffixes in the adapter's PEFT config, or explicitly specify --lora-target-modules during server startup. What it means
Raised in init_lora_shapes when an adapter's PEFT config specifies target_modules in a form SGLang cannot interpret (not a recognizable list of suffixes and not matching a known mapping) and no explicit --lora-target-modules was given. SGLang only auto-infers target modules from a list of module-name suffixes in the PEFT config.
Source
Thrown at python/sglang/srt/lora/lora_manager.py:697
# per-adapter inference for this adapter.
continue
else:
# Resolve by scanning the base model for all
# LoRA-compatible linear modules.
adapter_target_modules = auto_detect_lora_target_modules(
self.base_model
)
logger.info(
"LoRA adapter '%s' uses target_modules='%s'. "
"Resolved to %s by inspecting the base model.",
self.lora_refs[lora_id].lora_name,
config.target_modules,
sorted(adapter_target_modules),
)
self.target_modules.update(adapter_target_modules)
continue
else:
raise ValueError(
f"SGLang does not recognize target_modules="
f"'{config.target_modules}'. Please use a list of module "
"name suffixes in the adapter's PEFT config, or explicitly "
"specify --lora-target-modules during server startup."
)
if not isinstance(config.target_modules, list):
raise ValueError(
f"SGLang currently only supports inferring LoRA target modules when a list of "
"suffixes is provided in `target_modules` field of PEFT config. Please explicitly "
"specify `--lora-target-modules` during server startup. You can specify `all` to "
"enable all support modules types. "
)
adapter_target_modules = get_normalized_target_modules(
config.target_modules
)
View on GitHub (pinned to 0132848349)
Solutions
- Start the server with explicit --lora-target-modules listing the suffixes (or 'all')
- Edit the adapter's adapter_config.json to store an explicit list of module suffixes like ['q_proj','v_proj']
Example fix
# before --enable-lora # adapter config has target_modules=".*q_proj" # after --enable-lora --lora-target-modules q_proj v_proj o_proj
Defensive patterns
Strategy: validation
Validate before calling
import json
cfg = json.load(open(f'{path}/adapter_config.json'))
tm = cfg.get('target_modules')
if not isinstance(tm, list):
raise SystemExit('start server with --lora-target-modules, or fix adapter config') Type guard
def has_list_target_modules(cfg) -> bool:
tm = cfg.get('target_modules')
return isinstance(tm, list) and all(isinstance(x, str) for x in tm) Prevention
- Always pass --lora-target-modules when serving third-party adapters
- Normalize adapter configs at export time to suffix lists
When it happens
Trigger: Loading an adapter whose adapter_config.json has target_modules as a regex string (e.g. '.*q_proj|.*v_proj') or a keyword like 'all-linear', while the server was started without --lora-target-modules.
Common situations: Adapters trained with PEFT defaults that store a regex in target_modules; moving an adapter from vLLM/transformers to SGLang without adjusting config.
Understand the failure class
Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.
Related errors
- SGLang currently only supports inferring LoRA target modules
- LoRA adapter '{lora_name}' contains target modules {sorted(u
- DSA indexer weights_proj LoRA is incompatible with piecewise
- Failed to load LoRA adapter {lora_ref.lora_name} because it
- LoRA adapter {lora_ref.lora_name} with rank {lora_config.r}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/8d886e7111599287.
Report an issue: GitHub.