{"record":{"id":"cd4d7b8bc269ef72","repo":"sgl-project/sglang","slug":"weight-url-pins-revision-url-revision-r-which-c","errorCode":null,"errorMessage":"Weight URL pins revision {url_revision!r}, which conflicts with revision {revision!r}","messagePattern":"Weight URL pins revision (.+?), which conflicts with revision (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/weights/source.py","lineNumber":61,"sourceCode":"def is_explicit_weight_file_reference(source: str) -> bool:\n    \"\"\"Whether a component override names one weight file, not a component root.\"\"\"\n    expanded = os.path.expanduser(source)\n    if os.path.isdir(expanded):\n        return False\n    return urlparse(source).path.lower().endswith(_WEIGHT_SUFFIXES)\n\n\ndef _validate_relative_hub_path(path: str, field_name: str) -> str:\n    normalized = str(PurePosixPath(path))\n    pure_path = PurePosixPath(normalized)\n    if not path or pure_path.is_absolute() or \"..\" in pure_path.parts:\n        raise ValueError(f\"Invalid Hugging Face {field_name}: {path!r}\")\n    return normalized\n\n\ndef _merge_revision(url_revision: str | None, revision: str | None) -> str | None:\n    if url_revision is not None and revision is not None and url_revision != revision:\n        raise ValueError(\n            f\"Weight URL pins revision {url_revision!r}, which conflicts with \"\n            f\"revision {revision!r}\"\n        )\n    return url_revision or revision\n\n\ndef _parse_huggingface_url(source: str, revision: str | None) -> WeightSource:\n    parsed = urlparse(source)\n    if parsed.netloc.lower() not in (\"huggingface.co\", \"www.huggingface.co\"):\n        raise ValueError(\n            \"Only huggingface.co weight URLs are supported; use a local path \"\n            \"or an owner/repo reference for other sources\"\n        )\n\n    raw_parts = [part for part in parsed.path.split(\"/\") if part]\n    if raw_parts and raw_parts[0] in (\"datasets\", \"spaces\"):\n        raise ValueError(\"Diffusion weights must come from a Hugging Face model repo\")\n    if len(raw_parts) < 2:","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/weights/source.py#L43-L79","documentation":"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.","triggerScenarios":"Calling parse_weight_source(\"https://huggingface.co/org/repo/resolve/v2/file.safetensors\", revision=\"main\") where 'v2' != 'main'.","commonSituations":"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.","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"],"exampleFix":"# before\nparse_weight_source(\"https://huggingface.co/org/repo/tree/v2\", revision=\"main\")\n# after\nparse_weight_source(\"https://huggingface.co/org/repo/tree/v2\", revision=\"v2\")\n# or\nparse_weight_source(\"org/repo\", revision=\"v2\")","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse\nparsed = urlparse(url)\nparts = [p for p in parsed.path.split(\"/\") if p]\nurl_rev = parts[3] if len(parts) > 3 and parts[2] in (\"tree\", \"blob\", \"resolve\") else None\nif url_rev and revision and url_rev != revision:\n    revision = url_rev  # or raise early with a clear message","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["huggingface","weights","revision-conflict","configuration"],"backgroundTag":"conflicting-revision-specification","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}