{"record":{"id":"02b958fa49885601","repo":"sgl-project/sglang","slug":"weight-source-source-r-is-neither-a-local-path-n","errorCode":null,"errorMessage":"Weight source {source!r} is neither a local path nor an owner/repo Hugging Face reference","messagePattern":"Weight source (.+?) is neither a local path nor an owner/repo Hugging Face reference","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/weights/source.py","lineNumber":143,"sourceCode":"    parsed = urlparse(source)\n    if parsed.scheme in (\"http\", \"https\"):\n        return _parse_huggingface_url(source, revision)\n\n    looks_local = (\n        os.path.exists(expanded)\n        or os.path.isabs(expanded)\n        or source.startswith((\"./\", \"../\", \"~\"))\n    )\n    if looks_local:\n        return WeightSource(\n            original=source,\n            kind=\"local\",\n            local_path=os.path.abspath(expanded),\n        )\n\n    parts = source.split(\"/\")\n    if len(parts) < 2 or not all(parts[:2]):\n        raise ValueError(\n            f\"Weight source {source!r} is neither a local path nor an \"\n            \"owner/repo Hugging Face reference\"\n        )\n    repo_id = \"/\".join(parts[:2])\n    validate_repo_id(repo_id)\n    tail = \"/\".join(parts[2:]) or None\n    filename = (\n        _validate_relative_hub_path(tail, \"filename\")\n        if tail is not None and tail.lower().endswith(_WEIGHT_SUFFIXES)\n        else None\n    )\n    subfolder = tail if filename is None else None\n    if subfolder is not None:\n        subfolder = _validate_relative_hub_path(subfolder, \"subfolder\")\n    return WeightSource(\n        original=source,\n        kind=\"huggingface\",\n        repo_id=repo_id,","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/weights/source.py#L125-L161","documentation":"parse_weight_source accepts either an existing local filesystem path or a Hugging Face 'owner/repo' reference. This error fires when the string is neither: the path does not exist on disk AND it does not look like a two-segment owner/repo ID (fewer than two '/'-separated non-empty leading parts).","triggerScenarios":"Passing a bare model name like 'stable-diffusion' (one segment), an empty string, a URL that failed local-path expansion, or a typo'd repo id; also a local-looking path that does not exist.","commonSituations":"Typos in repo ids; forgetting the namespace prefix on HF hub ids; passing a path with an unexpanded '~' that does not exist; passing an http URL that is not recognized as a HF URL format.","solutions":["Check spelling and use the full 'owner/repo' HF id","If it is meant to be local, verify the path exists (and that '~' / env vars are intended)","For full URLs, use the huggingface.co URL form with a revision/file path so it is routed to the HF parser"],"exampleFix":"# before\nparse_weight_source(\"flux-dev\")\n# after\nparse_weight_source(\"black-forest-labs/flux-dev\")","handlingStrategy":"validation","validationCode":"import os\n\ndef is_valid_source(s: str) -> bool:\n    if os.path.exists(os.path.expanduser(s)):\n        return True\n    parts = s.split(\"/\")\n    return len(parts) >= 2 and all(parts[:2])","typeGuard":"def is_owner_repo_ref(s: str) -> bool:\n    parts = s.split(\"/\")\n    return len(parts) >= 2 and all(parts[:2]) and \"://\" not in s","tryCatchPattern":"try:\n    src = parse_weight_source(user_input)\nexcept ValueError as e:\n    raise SystemExit(f\"Bad weight source: {e}\") from e","preventionTips":["Validate user-supplied sources early in CLI parsing","Document the accepted formats (local path or owner/repo) at the input boundary"],"tags":["weights","source-parsing","huggingface"],"backgroundTag":"invalid-argument-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}