sgl-project/sglang · error · FileNotFoundError
Weight subfolder was not found in
Error message
Weight subfolder {source.subfolder!r} was not found in {source.repo_id} What it means
Raised when the configured weight subfolder does not exist inside the resolved repository, indicating a wrong subfolder path or repo contents.
Solutions
- List repo files and check the exact subfolder spelling/case
- Update the subfolder to the new layout or pin a revision where it exists
- Drop the subfolder to inspect the full file list first
Example fix
# before
resolve_weight("org/repo/flux-dev")
# after
resolve_weight("org/repo/FLUX.1-dev") Defensive patterns
Strategy: validation
Validate before calling
from huggingface_hub import list_repo_files
prefix = subfolder.rstrip("/") + "/"
assert any(f.startswith(prefix) for f in list_repo_files(repo_id, revision=rev)) Try / catch
try:
inv = resolve_weight_inventory(src)
except FileNotFoundError as e:
logger.error("subfolder missing: %s", e)
raise Prevention
- Verify subfolder spelling/case against the repo file listing
- Pin a revision you have inspected
When it happens
Trigger: Passing 'owner/repo/subfolder' where subfolder does not exist in the repo; trailing-slash or case mismatch in the subfolder; subfolder removed in the pinned revision.
Common situations: Repo layout changed between versions; typos in subfolder names; expecting a folder that only exists in a fork.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Diffusion weights must come from a Hugging Face model repo
- Download failed for after attempts due to download errors…
- Downloaded model files are still corrupted for
- Hugging Face weight URL has no filename
- Hugging Face weight URL has no model repo
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/da114814ba44e6e4.
Report an issue: GitHub.
Appendix: source
Thrown at python/sglang/multimodal_gen/runtime/weights/source.py:183
)
def _filter_inventory_files(
files: tuple[str, ...], source: WeightSource
) -> tuple[str, ...]:
if source.filename is not None:
selected = tuple(path for path in files if path == source.filename)
if not selected:
raise FileNotFoundError(
f"Weight file {source.filename!r} was not found in {source.repo_id}"
)
return selected
if source.subfolder is None:
return files
prefix = source.subfolder.rstrip("/") + "/"
selected = tuple(path for path in files if path.startswith(prefix))
if not selected:
raise FileNotFoundError(
f"Weight subfolder {source.subfolder!r} was not found in {source.repo_id}"
)
return selected
def resolve_weight_inventory(source: WeightSource) -> WeightInventory:
"""List source files and pin a remote source to an immutable revision."""
if source.kind == "local":
assert source.local_path is not None
local_path = Path(source.local_path)
if not local_path.exists():
raise FileNotFoundError(f"Weight path does not exist: {local_path}")
if local_path.is_file():
files = (local_path.name,)
else:
files = tuple(
path.relative_to(local_path).as_posix()
for path in sorted(local_path.rglob("*"))View on GitHub (pinned to 0132848349)