sgl-project/sglang · error · FileNotFoundError
Weight subfolder {source.subfolder!r} was not found in {sour
Error message
Weight subfolder {source.subfolder!r} was not found in {source.repo_id} What it means
The requested subfolder prefix matches zero files in the repo inventory at the pinned revision. The subfolder filter is applied after filename filtering when no explicit filename was given.
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)
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
- Invalid Hugging Face {field_name}: {path!r}
- Weight URL pins revision {url_revision!r}, which conflicts w
- Only huggingface.co weight URLs are supported; use a local p
- Diffusion weights must come from a Hugging Face model repo
- Hugging Face weight URL has no model repo: {source!r}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/da114814ba44e6e4.
Report an issue: GitHub.