sgl-project/sglang · error · FileNotFoundError

Weight path does not exist: {local_path}

Error message

Weight path does not exist: {local_path}

What it means

For a local WeightSource, resolve_weight_inventory stats the configured local_path and it does not exist on disk. The local branch never touches the network, so this is purely a filesystem miss.

Source

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

        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("*"))
                if path.is_file()
            )
        return WeightInventory(
            source=source,
            resolved_revision=None,
            files=files,
        )

    assert source.repo_id is not None
    model_info = HfApi().model_info(
        source.repo_id,
        revision=source.revision,

View on GitHub (pinned to 0132848349)

Solutions

  1. Verify the absolute path exists (os.path.abspath is applied before the check)
  2. Fix relative paths or run from the intended CWD
  3. Mount/copy the weights to the expected location

Example fix

# before
resolve_weight("./checkpoints/model")  # run from wrong cwd
# after
resolve_weight(os.path.expanduser("~/models/checkpoints/model"))
Defensive patterns

Strategy: validation

Validate before calling

import os
from pathlib import Path

p = Path(os.path.abspath(os.path.expanduser(source)))
assert p.exists(), f"missing weight path: {p}"

Try / catch

try:
    inv = resolve_weight_inventory(src)
except FileNotFoundError as e:
    logger.error("local weights missing: %s", e)
    raise

Prevention

When it happens

Trigger: Passing a local directory or file path that was moved/removed; relative path resolved against a different CWD; symlink to a missing target.

Common situations: Scripts run from a different working directory; paths from config files stale after data relocation; containers without mounted weights.

Related errors


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