{"record":{"id":"dbfb38fc74eb694c","repo":"sgl-project/sglang","slug":"source-contains-no-recognized-weight-files","errorCode":null,"errorMessage":"Source contains no recognized weight files","messagePattern":"Source contains no recognized weight files","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/weights/source.py","lineNumber":254,"sourceCode":"        f\"{list(basename_matches)}\"\n    )\n\n\ndef select_weight_file(\n    inventory: WeightInventory, weight_name: str | None = None\n) -> str:\n    \"\"\"Select weights deterministically; never guess among independent files.\"\"\"\n    candidates = tuple(\n        path for path in inventory.files if path.lower().endswith(_WEIGHT_SUFFIXES)\n    )\n    if inventory.source.filename is not None:\n        return inventory.files[0]\n    if weight_name is not None:\n        return _select_named_file(candidates, weight_name)\n    if len(candidates) == 1:\n        return candidates[0]\n    if not candidates:\n        raise FileNotFoundError(\"Source contains no recognized weight files\")\n    raise ValueError(\n        \"Source contains multiple independent weight files; select one with \"\n        f\"an exact file URL or weight name. Candidates: {list(candidates)}\"\n    )\n\n\ndef resolve_weight(\n    source: str,\n    *,\n    revision: str | None = None,\n    weight_name: str | None = None,\n) -> ResolvedWeight:\n    \"\"\"Resolve one weight file without downloading its tensor payload.\"\"\"\n    parsed_source = parse_weight_source(source, revision=revision)\n    inventory = resolve_weight_inventory(parsed_source)\n    selected_file = select_weight_file(inventory, weight_name)\n    return ResolvedWeight(\n        inventory=inventory,","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/weights/source.py#L236-L272","documentation":"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.","triggerScenarios":"A local directory or repo containing only non-weight files (configs, tokenizers, arbitrary binaries) or files with unrecognized extensions/names.","commonSituations":"Pointing the resolver at a config-only directory; a checkpoint format the recognizer does not know; an empty or partially-downloaded directory.","solutions":["List inventory.files and check the actual filenames","Point at the directory/repo that holds the real safetensors weights","If the naming is legitimately supported, report/extend the recognition patterns upstream"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"inv = resolve_weight_inventory(parse_weight_source(source))\nif not inv.files:\n    raise SystemExit(\"no files in source; wrong directory/repo?\")","typeGuard":null,"tryCatchPattern":"try:\n    f = select_weight_file(inv)\nexcept FileNotFoundError as e:\n    logger.error(\"source has no recognized weights: %s\", inv.files)\n    raise","preventionTips":["Sanity-check the directory listing before running pipelines","Keep weight files in conventional names the recognizer supports"],"tags":["weights","file-selection","no-candidates"],"backgroundTag":"no-recognized-files","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}