{"record":{"id":"0d5192593781680b","repo":"sgl-project/sglang","slug":"sglang-currently-only-supports-inferring-lora-targ","errorCode":null,"errorMessage":"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. ","messagePattern":"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\\. ","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/lora/lora_manager.py","lineNumber":705,"sourceCode":"                        logger.info(\n                            \"LoRA adapter '%s' uses target_modules='%s'. \"\n                            \"Resolved to %s by inspecting the base model.\",\n                            self.lora_refs[lora_id].lora_name,\n                            config.target_modules,\n                            sorted(adapter_target_modules),\n                        )\n                        self.target_modules.update(adapter_target_modules)\n                        continue\n                else:\n                    raise ValueError(\n                        f\"SGLang does not recognize target_modules=\"\n                        f\"'{config.target_modules}'. Please use a list of module \"\n                        \"name suffixes in the adapter's PEFT config, or explicitly \"\n                        \"specify --lora-target-modules during server startup.\"\n                    )\n\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)}. \"","sourceCodeStart":687,"sourceCodeEnd":723,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/lora/lora_manager.py#L687-L723","documentation":"Raised in init_lora_shapes when the resolved PEFT config's target_modules field is not a Python list. SGLang's inference of target modules only supports a list of module name suffixes; strings (regex or single names), dicts, or None all trigger this error asking for an explicit --lora-target-modules flag.","triggerScenarios":"init_state with an adapter whose target_modules is a string (single module or regex) or any non-list type, regardless of other content, because the isinstance(config.target_modules, list) check fails.","commonSituations":"PEFT versions that serialize target_modules as a string; hand-edited adapter configs; adapters targeting a single module stored as a bare string.","solutions":["Pass --lora-target-modules at startup (suffix list or 'all')","Rewrite adapter_config.json so target_modules is a JSON array of suffixes"],"exampleFix":"# before\n{\"target_modules\": \"q_proj\"}\n# after\n{\"target_modules\": [\"q_proj\", \"v_proj\"]}","handlingStrategy":"type-guard","validationCode":"assert isinstance(config.target_modules, list), 'target_modules must be a list of suffixes; pass --lora-target-modules'","typeGuard":"def is_suffix_list(value) -> bool:\n    return isinstance(value, list) and bool(value) and all(isinstance(v, str) for v in value)","tryCatchPattern":null,"preventionTips":["Always set --lora-target-modules to remove dependence on config inference","Post-process adapter_config.json to coerce strings to lists"],"tags":["lora","target-modules","type-error","peft-config","sglang"],"backgroundTag":"config-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}