sgl-project/sglang · error · ValueError
Weight URL pins revision {url_revision!r}, which conflicts w
Error message
Weight URL pins revision {url_revision!r}, which conflicts with revision {revision!r} What it means
Raised by _merge_revision when a Hugging Face URL already pins a revision (e.g. .../tree/main/...) and the caller also passes a different revision kwarg. The two must agree or be omitted to avoid ambiguity about which weights to load.
Source
Thrown at python/sglang/multimodal_gen/runtime/weights/source.py:61
def is_explicit_weight_file_reference(source: str) -> bool:
"""Whether a component override names one weight file, not a component root."""
expanded = os.path.expanduser(source)
if os.path.isdir(expanded):
return False
return urlparse(source).path.lower().endswith(_WEIGHT_SUFFIXES)
def _validate_relative_hub_path(path: str, field_name: str) -> str:
normalized = str(PurePosixPath(path))
pure_path = PurePosixPath(normalized)
if not path or pure_path.is_absolute() or ".." in pure_path.parts:
raise ValueError(f"Invalid Hugging Face {field_name}: {path!r}")
return normalized
def _merge_revision(url_revision: str | None, revision: str | None) -> str | None:
if url_revision is not None and revision is not None and url_revision != revision:
raise ValueError(
f"Weight URL pins revision {url_revision!r}, which conflicts with "
f"revision {revision!r}"
)
return url_revision or revision
def _parse_huggingface_url(source: str, revision: str | None) -> WeightSource:
parsed = urlparse(source)
if parsed.netloc.lower() not in ("huggingface.co", "www.huggingface.co"):
raise ValueError(
"Only huggingface.co weight URLs are supported; use a local path "
"or an owner/repo reference for other sources"
)
raw_parts = [part for part in parsed.path.split("/") if part]
if raw_parts and raw_parts[0] in ("datasets", "spaces"):
raise ValueError("Diffusion weights must come from a Hugging Face model repo")
if len(raw_parts) < 2:View on GitHub (pinned to 0132848349)
Solutions
- Make the revision kwarg match the URL-pinned revision (or omit it)
- Remove the revision segment from the URL and control the revision solely via the revision argument
- Prefer passing the full commit hash in one single place
Example fix
# before
parse_weight_source("https://huggingface.co/org/repo/tree/v2", revision="main")
# after
parse_weight_source("https://huggingface.co/org/repo/tree/v2", revision="v2")
# or
parse_weight_source("org/repo", revision="v2") Defensive patterns
Strategy: validation
Validate before calling
from urllib.parse import urlparse
parsed = urlparse(url)
parts = [p for p in parsed.path.split("/") if p]
url_rev = parts[3] if len(parts) > 3 and parts[2] in ("tree", "blob", "resolve") else None
if url_rev and revision and url_rev != revision:
revision = url_rev # or raise early with a clear message Prevention
- Specify the revision in exactly one place (URL or argument)
- Pin the full commit hash once in config and derive both URL and arg from it
When it happens
Trigger: Calling parse_weight_source("https://huggingface.co/org/repo/resolve/v2/file.safetensors", revision="main") where 'v2' != 'main'.
Common situations: Server config pins a branch in the URL while a CLI/config revision flag still points at main or a different commit; upgrading models by editing only one of the two places.
Related errors
- Invalid Hugging Face {field_name}: {path!r}
- 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}
- Unsupported Hugging Face weight URL: {source!r}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/cd4d7b8bc269ef72.
Report an issue: GitHub.