{"record":{"id":"d3505a154afecae6","repo":"sgl-project/sglang","slug":"invalid-target-s-invalid-targets-valid-target","errorCode":null,"errorMessage":"Invalid target(s): {invalid_targets}. Valid targets: {self.VALID_TARGETS}","messagePattern":"Invalid target\\(s\\): (.+?)\\. Valid targets: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/lora/pipeline.py","lineNumber":966,"sourceCode":"        Supports both single LoRA (backward compatible) and multiple LoRA adapters.\n\n        cache_merged re-homes merged weights to a file-backed store so they\n        stop costing anonymous host memory; pass it only for the startup\n        (static) adapter, where the merged combination is stable.\n        \"\"\"\n        merge_mode = self._resolve_lora_merge_mode(merge_weights, merge_mode)\n\n        # Normalize inputs to lists for multi-LoRA support\n        lora_nicknames, lora_paths, strengths, targets, lora_alphas = (\n            self._normalize_lora_params(\n                lora_nickname, lora_path, strength, target, lora_alpha\n            )\n        )\n\n        # Validate targets\n        invalid_targets = [t for t in targets if t not in self.VALID_TARGETS]\n        if invalid_targets:\n            raise ValueError(\n                f\"Invalid target(s): {invalid_targets}. Valid targets: {self.VALID_TARGETS}\"\n            )\n\n        # Checked before disabling offload, which materializes every layer: on a\n        # memory-constrained deployment that would OOM instead of returning the\n        # unsupported-LoRA error. Offloaded placeholders still carry the name.\n        self._reject_lora_on_packed_weights()\n\n        # Disable layerwise offload before convert_to_lora_layers to ensure weights are accessible\n        # This is critical because convert_to_lora_layers needs to save cpu_weight from actual weights,\n        # not from offloaded placeholder tensors\n        if not self.lora_initialized:\n            with self._temporarily_disable_offload(\n                target=\"all\", use_module_names_only=True\n            ):\n                self.convert_to_lora_layers()\n\n        # Check adapter presence and load missing adapters","sourceCodeStart":948,"sourceCodeEnd":984,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/lora/pipeline.py#L948-L984","documentation":"set_lora validates each entry of targets against the pipeline class's VALID_TARGETS class attribute; unknown target module names are rejected before any weights are touched (deliberately before offload is disabled, to avoid OOM on constrained deployments).","triggerScenarios":"Calling set_lora(targets=['attn']) or any module name not in e.g. {'attn', 'fc1', 'fc2', ...} for your pipeline class.","commonSituations":"Using target names from a different model family (LLM PEFT targets like 'q_proj' on a DiT pipeline); typo; new model version renamed layers without updating VALID_TARGETS.","solutions":["Print pipeline.VALID_TARGETS and use one of those names","Check the pipeline subclass matching your model — targets differ per architecture","Fix typos like 'attention' vs 'attn'"],"exampleFix":"# before\npipeline.set_lora(..., targets=['q_proj'])\n# after\npipeline.set_lora(..., targets=['attn'])","handlingStrategy":"type-guard","validationCode":"invalid = [t for t in targets if t not in pipeline.VALID_TARGETS]\nassert not invalid, f'invalid targets {invalid}; valid: {pipeline.VALID_TARGETS}'","typeGuard":"def valid_targets(pipeline, targets: list[str]) -> bool:\n    return all(t in pipeline.VALID_TARGETS for t in targets)","tryCatchPattern":null,"preventionTips":["Print VALID_TARGETS once at pipeline setup and assert config against it"],"tags":["lora","config-validation","invalid-target"],"backgroundTag":"invalid-config-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}