{"record":{"id":"03e28eab0289efab","repo":"sgl-project/sglang","slug":"lora-adapter-lora-name-contains-target-modules","errorCode":null,"errorMessage":"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.","messagePattern":"LoRA adapter '(.+?)' contains target modules (.+?) that are not included in the specified --lora-target-modules (.+?)\\. Please update --lora-target-modules to include all required modules: (.+?), or use 'all' to enable all supported modules\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/lora/lora_manager.py","lineNumber":721,"sourceCode":"\n            if not isinstance(config.target_modules, list):\n                raise ValueError(\n                    f\"SGLang currently only supports inferring LoRA target modules when a list of \"\n                    \"suffixes is provided in `target_modules` field of PEFT config. Please explicitly \"\n                    \"specify `--lora-target-modules` during server startup. You can specify `all` to \"\n                    \"enable all support modules types. \"\n                )\n\n            adapter_target_modules = get_normalized_target_modules(\n                config.target_modules\n            )\n\n            if target_modules is not None:\n                # When `--lora-target-modules` is provided, validate adapter target modules is a subset of the specified target modules.\n                if not adapter_target_modules.issubset(self.target_modules):\n                    unsupported_modules = adapter_target_modules - self.target_modules\n                    lora_name = self.lora_refs[lora_id].lora_name\n                    raise ValueError(\n                        f\"LoRA adapter '{lora_name}' contains target modules {sorted(unsupported_modules)} \"\n                        f\"that are not included in the specified --lora-target-modules {sorted(self.target_modules)}. \"\n                        f\"Please update --lora-target-modules to include all required modules: \"\n                        f\"{sorted(self.target_modules | adapter_target_modules)}, or use 'all' to enable all supported modules.\"\n                    )\n            else:\n                # Otherwise, infer target_modules from adapter configs.\n                self.target_modules.update(adapter_target_modules)\n\n        # Fusion folds wk + weights_proj into wk_weights_proj, so the modules\n        # LoRA wraps are absent and an indexer-targeted adapter is silently dropped.\n        indexer_targets = self.target_modules & DSA_INDEXER_LORA_NAMES\n        if indexer_targets:\n            from sglang.srt.layers.attention.dsa.dsa_indexer import (\n                _use_dsa_indexer_fusion,\n            )\n\n            if _use_dsa_indexer_fusion:","sourceCodeStart":703,"sourceCodeEnd":739,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/lora/lora_manager.py#L703-L739","documentation":"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.","triggerScenarios":"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.","commonSituations":"Copy-pasting a target-module list from a different model architecture; using an adapter trained on MLP modules with a projection-only server config.","solutions":["Restart with the union of modules, e.g. --lora-target-modules including everything in the error message","Use --lora-target-modules all to enable every supported module type","Use an adapter whose targets match the server configuration"],"exampleFix":"# before\n--lora-target-modules q_proj k_proj v_proj\n# after\n--lora-target-modules q_proj k_proj v_proj gate_up_proj down_proj","handlingStrategy":"validation","validationCode":"adapter_targets = set(config.target_modules)\nserver_targets = set(server_args.lora_target_modules)\nmissing = adapter_targets - server_targets\nif missing:\n    print(f'add to --lora-target-modules: {sorted(server_targets | adapter_targets)}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive --lora-target-modules from your adapter configs (union), not from docs of another model","Use 'all' during experimentation"],"tags":["lora","target-modules","subset-validation","sglang"],"backgroundTag":"config-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}