sgl-project/sglang · error · ValueError
Source contains multiple independent weight files; select on
Error message
Source contains multiple independent weight files; select one with an exact file URL or weight name. Candidates: {list(candidates)} What it means
Multiple candidate weight files were found and no weight_name or exact file URL was provided, so the choice is ambiguous and the resolver requires an explicit selection.
Source
Thrown at python/sglang/multimodal_gen/runtime/weights/source.py:255
)
def select_weight_file(
inventory: WeightInventory, weight_name: str | None = None
) -> str:
"""Select weights deterministically; never guess among independent files."""
candidates = tuple(
path for path in inventory.files if path.lower().endswith(_WEIGHT_SUFFIXES)
)
if inventory.source.filename is not None:
return inventory.files[0]
if weight_name is not None:
return _select_named_file(candidates, weight_name)
if len(candidates) == 1:
return candidates[0]
if not candidates:
raise FileNotFoundError("Source contains no recognized weight files")
raise ValueError(
"Source contains multiple independent weight files; select one with "
f"an exact file URL or weight name. Candidates: {list(candidates)}"
)
def resolve_weight(
source: str,
*,
revision: str | None = None,
weight_name: str | None = None,
) -> ResolvedWeight:
"""Resolve one weight file without downloading its tensor payload."""
parsed_source = parse_weight_source(source, revision=revision)
inventory = resolve_weight_inventory(parsed_source)
selected_file = select_weight_file(inventory, weight_name)
return ResolvedWeight(
inventory=inventory,
selected_file=selected_file,View on GitHub (pinned to 0132848349)
Solutions
- Pass weight_name for the desired basename
- Use an exact file URL to pin one file
- Restrict the source to the subfolder containing the desired file
Example fix
# before
resolve_weight("org/repo")
# after
resolve_weight("org/repo", weight_name="model_fp8.safetensors") Defensive patterns
Strategy: validation
Validate before calling
inv = resolve_weight_inventory(parse_weight_source(source))
if len(inv.files) > 1 and weight_name is None:
raise SystemExit(f"multiple weights {inv.files}; pass weight_name") Try / catch
try:
f = select_weight_file(inv)
except ValueError as e:
logger.error("%s", e) # lists candidates
raise Prevention
- Always pass weight_name for multi-file sources in scripts
- Log the candidate list from the error to pick the right file
When it happens
Trigger: A repo or directory containing several independent recognized weight files (e.g. both a full checkpoint and a sharded/fp8 variant) and calling resolve_weight(source) with no selector.
Common situations: Mixed-format checkpoints in one folder; repos with bf16 and fp8 exports side by side.
Related errors
- Weight name {weight_name!r} matches multiple files: {list(ba
- Duplicate tensor names detected across safetensors files. Re
- RIFE weight file not found: {flownet_path} Expected layout:
- 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/d5eabe20dc90b78c.
Report an issue: GitHub.