sgl-project/sglang · error · ValueError

LoRA adapter '{lora_name}' contains target modules {sorted(u

Error message

LoRA adapter '{lora_name}' contains target modules {sorted(unsupported_modules)} that are not included in the specified --lora-target-modules {sorted(self.target_modules)}. Please update --lora-target-modules to include all required modules: {sorted(self.target_modules | adapter_target_modules)}, or use 'all' to enable all supported modules.

What it means

Raised in init_lora_shapes when --lora-target-modules was explicitly provided but an adapter contains target module suffixes outside that set. Since the pool and wrappers are only built for the specified modules, an adapter targeting e.g. gate_up_proj when only q_proj/k_proj were configured cannot be applied.

Source

Thrown at python/sglang/srt/lora/lora_manager.py:721

            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
            )

            if target_modules is not None:
                # When `--lora-target-modules` is provided, validate adapter target modules is a subset of the specified target modules.
                if not adapter_target_modules.issubset(self.target_modules):
                    unsupported_modules = adapter_target_modules - self.target_modules
                    lora_name = self.lora_refs[lora_id].lora_name
                    raise ValueError(
                        f"LoRA adapter '{lora_name}' contains target modules {sorted(unsupported_modules)} "
                        f"that are not included in the specified --lora-target-modules {sorted(self.target_modules)}. "
                        f"Please update --lora-target-modules to include all required modules: "
                        f"{sorted(self.target_modules | adapter_target_modules)}, or use 'all' to enable all supported modules."
                    )
            else:
                # Otherwise, infer target_modules from adapter configs.
                self.target_modules.update(adapter_target_modules)

        # Fusion folds wk + weights_proj into wk_weights_proj, so the modules
        # LoRA wraps are absent and an indexer-targeted adapter is silently dropped.
        indexer_targets = self.target_modules & DSA_INDEXER_LORA_NAMES
        if indexer_targets:
            from sglang.srt.layers.attention.dsa.dsa_indexer import (
                _use_dsa_indexer_fusion,
            )

            if _use_dsa_indexer_fusion:

View on GitHub (pinned to 0132848349)

Solutions

  1. Restart with the union of modules, e.g. --lora-target-modules including everything in the error message
  2. Use --lora-target-modules all to enable every supported module type
  3. Use an adapter whose targets match the server configuration

Example fix

# before
--lora-target-modules q_proj k_proj v_proj
# after
--lora-target-modules q_proj k_proj v_proj gate_up_proj down_proj
Defensive patterns

Strategy: validation

Validate before calling

adapter_targets = set(config.target_modules)
server_targets = set(server_args.lora_target_modules)
missing = adapter_targets - server_targets
if missing:
    print(f'add to --lora-target-modules: {sorted(server_targets | adapter_targets)}')

Prevention

When it happens

Trigger: Server started with --lora-target-modules q_proj k_proj v_proj and an adapter whose config also lists gate_up_proj/down_proj; the issubset check fails and unsupported_modules is non-empty.

Common situations: Copy-pasting a target-module list from a different model architecture; using an adapter trained on MLP modules with a projection-only server 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


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/03e28eab0289efab. Report an issue: GitHub.