sgl-project/sglang · error · FileNotFoundError

Resolved LoRA weight {selected_file!r} was not downloaded to

Error message

Resolved LoRA weight {selected_file!r} was not downloaded to {local_path}

What it means

maybe_download_lora downloads the resolved LoRA repo snapshot into local_path and then verifies selected_file landed on disk. If the expected file is missing after download (filtered out by allow_patterns, partial download, unexpected repo layout), FileNotFoundError.

Source

Thrown at python/sglang/multimodal_gen/runtime/utils/hf_diffusers_utils.py:680

            return source.local_path
        return os.path.join(source.local_path, selected_file)

    assert source.repo_id is not None
    allow_patterns = ["*.json", selected_file]
    selected_parent = os.path.dirname(selected_file)
    if selected_parent:
        allow_patterns.insert(1, f"{selected_parent}/*.json")
    local_path = maybe_download_model(
        source.repo_id,
        local_dir,
        download,
        is_lora=True,
        allow_patterns=allow_patterns,
        revision=resolved_weight.inventory.resolved_revision or source.revision,
    )
    target = os.path.join(local_path, selected_file)
    if not os.path.isfile(target):
        raise FileNotFoundError(
            f"Resolved LoRA weight {selected_file!r} was not downloaded to {local_path}"
        )
    return target


def verify_model_config_and_directory(model_path: str) -> dict[str, Any]:
    """
    Verify that the model directory contains a valid diffusers configuration.

    Args:
        model_path: Path to the model directory

    Returns:
        The loaded model configuration as a dictionary
    """

    # Check for model_index.json which is required for diffusers models
    config_path = os.path.join(model_path, "model_index.json")

View on GitHub (pinned to 0132848349)

Solutions

  1. Retry once after clearing the partial HF cache entry for the LoRA repo
  2. Verify the file exists in the repo at the resolved revision (huggingface-cli repo-files or web UI) and that its path matches the selected weight name
  3. Pre-download the LoRA locally and pass the local path + exact weight_name
Defensive patterns

Strategy: retry

Validate before calling

import os
assert os.path.isfile(os.path.join(local_path, selected_file)), 'download incomplete'

Try / catch

for attempt in range(2):
    try:
        return maybe_download_lora(...)
    except FileNotFoundError:
        clear_hf_cache_entry(repo); continue

Prevention

When it happens

Trigger: Calling load_lora_adapter on a remote LoRA repo where the resolved selected_file does not match the downloaded allow_patterns, or the download silently failed / was interrupted.

Common situations: HF repo restructured so the weight sits outside the patterns; flaky network yielding an incomplete snapshot; revision mismatch between resolve and download steps.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/17dc1e2e073900bf. Report an issue: GitHub.