{"record":{"id":"aefb5edfd2bcdac5","repo":"sgl-project/sglang","slug":"specified-lora-weight-name-weight-name-not-fou","errorCode":null,"errorMessage":"Specified lora_weight_name '{weight_name}' not found in {local_path}","messagePattern":"Specified lora_weight_name '(.+?)' not found in (.+?)","errorType":"validation","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/utils/hf_diffusers_utils.py","lineNumber":638,"sourceCode":"    if envs.SGLANG_USE_MODELSCOPE.get():\n        allow_patterns = (\n            [\"*.json\", weight_name, f\"**/{weight_name}\"]\n            if weight_name is not None\n            else [\"*.json\", \"*.safetensors\", \"*.bin\"]\n        )\n        local_path = maybe_download_model(\n            model_name_or_path,\n            local_dir,\n            download,\n            is_lora=True,\n            allow_patterns=allow_patterns,\n        )\n        if os.path.isfile(local_path):\n            return local_path\n        if weight_name is not None:\n            target = os.path.join(local_path, weight_name)\n            if not os.path.isfile(target):\n                raise FileNotFoundError(\n                    f\"Specified lora_weight_name '{weight_name}' not found in \"\n                    f\"{local_path}\"\n                )\n            return target\n        guessed = _best_guess_weight_name(local_path, file_extension=\".safetensors\")\n        if guessed is None and current_platform.is_rocm():\n            guessed = _best_guess_weight_name(\n                model_name_or_path, file_extension=\".safetensors\"\n            )\n        return os.path.join(local_path, guessed)\n\n    resolved_weight = resolve_weight(model_name_or_path, weight_name=weight_name)\n    selected_file = resolved_weight.selected_file\n    if not selected_file.endswith(\".safetensors\"):\n        raise ValueError(\n            \"Native diffusion LoRA loading requires a safetensors file, got \"\n            f\"{selected_file!r}\"\n        )","sourceCodeStart":620,"sourceCodeEnd":656,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/utils/hf_diffusers_utils.py#L620-L656","documentation":"When a LoRA is loaded from a local directory with an explicit lora_weight_name, maybe_download_lora verifies that <local_path>/<weight_name> exists as a file. If not, FileNotFoundError.","triggerScenarios":"Calling load_lora_adapter with a local lora_path plus a lora_weight_name that does not exist in that directory (typo, wrong extension like .bin vs .safetensors, or the file lives in a subfolder).","commonSituations":"Typos in weight names; copying only some files from a LoRA repo; expecting .bin when only .safetensors was published.","solutions":["List the directory contents and use the exact filename: ls <local_path>","Fix the extension (.safetensors is required for native loading)","If the file is in a subfolder, point lora_path at the folder containing it or omit weight_name to trigger best-guess"],"exampleFix":"# before\nload_lora_adapter(\"/loras/sxzl\", weight_name=\"pytorch_lora_weights.bin\")\n# after\nload_lora_adapter(\"/loras/sxzl\", weight_name=\"pytorch_lora_weights.safetensors\")","handlingStrategy":"validation","validationCode":"import os\ntarget = os.path.join(local_path, weight_name)\nassert os.path.isfile(target), f'{weight_name} not in {local_path}: {os.listdir(local_path)}'","typeGuard":null,"tryCatchPattern":"try:\n    load_lora_adapter(path, weight_name=w)\nexcept FileNotFoundError:\n    w = pick_safetensors(os.listdir(path))  # fallback pick\n    load_lora_adapter(path, weight_name=w)","preventionTips":["List the LoRA directory and copy exact filenames","Prefer safetensors variants when choosing weight names"],"tags":["lora","file-not-found","local-model"],"backgroundTag":"model-file-not-found","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}