sgl-project/sglang · error · FileNotFoundError

Source contains no recognized weight files

Error message

Source contains no recognized weight files

What it means

No weight_name was given and none of the inventory files match the library's recognized weight-file patterns, leaving zero candidates. The library cannot pick a file it does not recognize.

Source

Thrown at python/sglang/multimodal_gen/runtime/weights/source.py:254

        f"{list(basename_matches)}"
    )


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,

View on GitHub (pinned to 0132848349)

Solutions

  1. List inventory.files and check the actual filenames
  2. Point at the directory/repo that holds the real safetensors weights
  3. If the naming is legitimately supported, report/extend the recognition patterns upstream
Defensive patterns

Strategy: validation

Validate before calling

inv = resolve_weight_inventory(parse_weight_source(source))
if not inv.files:
    raise SystemExit("no files in source; wrong directory/repo?")

Try / catch

try:
    f = select_weight_file(inv)
except FileNotFoundError as e:
    logger.error("source has no recognized weights: %s", inv.files)
    raise

Prevention

When it happens

Trigger: A local directory or repo containing only non-weight files (configs, tokenizers, arbitrary binaries) or files with unrecognized extensions/names.

Common situations: Pointing the resolver at a config-only directory; a checkpoint format the recognizer does not know; an empty or partially-downloaded directory.

Related errors


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