sgl-project/sglang · error · FileNotFoundError
Weight file {source.filename!r} was not found in {source.rep
Error message
Weight file {source.filename!r} was not found in {source.repo_id} What it means
After listing the repo's files, the resolver filters for the exact filename requested via the URL or WeightSource and finds no match in the repo at the pinned revision. The file simply is not present under that name in that repo/revision.
Source
Thrown at python/sglang/multimodal_gen/runtime/weights/source.py:174
if subfolder is not None:
subfolder = _validate_relative_hub_path(subfolder, "subfolder")
return WeightSource(
original=source,
kind="huggingface",
repo_id=repo_id,
revision=revision,
subfolder=subfolder,
filename=filename,
)
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 NoneView on GitHub (pinned to 0132848349)
Solutions
- List the repo files (e.g. huggingface_hub.list_repo_files) to confirm the exact path
- Fix the filename spelling/case in the URL
- Pin the correct revision that contains the file
Example fix
# before
parse_weight_source("org/repo/resolve/main/model.safetenors")
# after
parse_weight_source("org/repo/resolve/main/model.safetensors") Defensive patterns
Strategy: validation
Validate before calling
from huggingface_hub import list_repo_files
files = list_repo_files(repo_id, revision=rev)
assert desired_filename in files, f"{desired_filename} not in repo" Try / catch
try:
inv = resolve_weight_inventory(src)
except FileNotFoundError as e:
logger.error("weight file missing: %s", e)
raise Prevention
- Pin revisions whose file lists you have verified
- Check exact filename case against the repo listing
When it happens
Trigger: Passing an exact file URL for a file that does not exist in the repo; filename case mismatch; the file only exists on a different revision (branch) than the pinned one.
Common situations: File renamed between revisions; using resolve/main for a file that lives on a feature branch; misspelled or case-different filename.
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
- No model weights found in {path} (expected model.safetensors
- RIFE weight file not found: {flownet_path} Expected layout:
- {exc}
- Invalid Hugging Face {field_name}: {path!r}
- Weight URL pins revision {url_revision!r}, which conflicts w
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/ee82e852b097e4f1.
Report an issue: GitHub.