{"record":{"id":"8d886e7111599287","repo":"sgl-project/sglang","slug":"sglang-does-not-recognize-target-modules-config","errorCode":null,"errorMessage":"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.","messagePattern":"SGLang does not recognize 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\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/lora/lora_manager.py","lineNumber":697,"sourceCode":"                        # per-adapter inference for this adapter.\n                        continue\n                    else:\n                        # Resolve by scanning the base model for all\n                        # LoRA-compatible linear modules.\n                        adapter_target_modules = auto_detect_lora_target_modules(\n                            self.base_model\n                        )\n                        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","sourceCodeStart":679,"sourceCodeEnd":715,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/lora/lora_manager.py#L679-L715","documentation":"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.","triggerScenarios":"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.","commonSituations":"Adapters trained with PEFT defaults that store a regex in target_modules; moving an adapter from vLLM/transformers to SGLang without adjusting config.","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']"],"exampleFix":"# before\n--enable-lora  # adapter config has target_modules=\".*q_proj\"\n# after\n--enable-lora --lora-target-modules q_proj v_proj o_proj","handlingStrategy":"validation","validationCode":"import json\ncfg = json.load(open(f'{path}/adapter_config.json'))\ntm = cfg.get('target_modules')\nif not isinstance(tm, list):\n    raise SystemExit('start server with --lora-target-modules, or fix adapter config')","typeGuard":"def has_list_target_modules(cfg) -> bool:\n    tm = cfg.get('target_modules')\n    return isinstance(tm, list) and all(isinstance(x, str) for x in tm)","tryCatchPattern":null,"preventionTips":["Always pass --lora-target-modules when serving third-party adapters","Normalize adapter configs at export time to suffix lists"],"tags":["lora","target-modules","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"}