{"record":{"id":"c682eb2e1f29a3c8","repo":"sgl-project/sglang","slug":"failed-to-download-real-esrgan-weights-from-huggin","errorCode":null,"errorMessage":"Failed to download Real-ESRGAN weights from HuggingFace repo '{repo_id}' (file: '{filename}'). If you are using a custom model, provide either a local .pth file path or use the 'repo_id:filename' format (e.g. 'my-org/my-esrgan:weights.pth'). Original error: {e}","messagePattern":"Failed to download Real-ESRGAN weights from HuggingFace repo '(.+?)' \\(file: '(.+?)'\\)\\. If you are using a custom model, provide either a local \\.pth file path or use the 'repo_id:filename' format \\(e\\.g\\. 'my-org/my-esrgan:weights\\.pth'\\)\\. Original error: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/postprocess/realesrgan_upscaler.py","lineNumber":756,"sourceCode":"        from huggingface_hub import hf_hub_download\n    except ImportError as e:\n        raise ImportError(\n            \"huggingface_hub is required to download Real-ESRGAN weights. \"\n            \"Install it with: pip install huggingface_hub\"\n        ) from e\n\n    logger.info(\n        \"Downloading Real-ESRGAN weights from HF repo %s (file: %s)\",\n        repo_id,\n        filename,\n    )\n    try:\n        local_path = hf_hub_download(\n            repo_id=repo_id,\n            filename=filename,\n        )\n    except Exception as e:\n        raise FileNotFoundError(\n            f\"Failed to download Real-ESRGAN weights from HuggingFace repo \"\n            f\"'{repo_id}' (file: '{filename}'). If you are using a custom \"\n            f\"model, provide either a local .pth file path or use the \"\n            f\"'repo_id:filename' format (e.g. 'my-org/my-esrgan:weights.pth'). \"\n            f\"Original error: {e}\"\n        ) from e\n    _RESOLVED_MODEL_PATH_CACHE[model_path] = local_path\n    return local_path\n\n\n# ---------------------------------------------------------------------------\n# Module-level convenience function\n# ---------------------------------------------------------------------------\n\n\ndef upscale_frames(\n    frames: list[np.ndarray],\n    model_path: Optional[str] = None,","sourceCodeStart":738,"sourceCodeEnd":774,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/postprocess/realesrgan_upscaler.py#L738-L774","documentation":"FileNotFoundError raised when hf_hub_download fails for the resolved repo_id/filename — network errors, nonexistent repo/file, auth requirements, or rate limits all surface here, chained with the original exception.","triggerScenarios":"model_path like 'my-org/my-esrgan' where the default filename doesn't exist in the repo, or 'repo:filename' pointing at a wrong file name; also offline environments or private repos without a token.","commonSituations":"Repo renamed/removed; typo in filename; missing HF_TOKEN for gated repos; proxy/firewall blocking huggingface.co.","solutions":["Use the explicit 'repo_id:filename' format with the exact file name in the repo","hf_hub_download the file manually to verify access/auth","For offline use, download the .pth and pass a local path"],"exampleFix":"# before\nmodel_path = \"my-org/my-esrgan\"\n# after\nmodel_path = \"my-org/my-esrgan:weights.pth\"","handlingStrategy":"try-catch","validationCode":"from huggingface_hub import HfApi\nfiles = HfApi().list_repo_files(repo_id)\nassert filename in files","typeGuard":null,"tryCatchPattern":"try:\n    upscaler.upscale(img)\nexcept FileNotFoundError as e:\n    if \"Failed to download\" in str(e):\n        upscaler = RealESRGANUpscaler(model_path=LOCAL_FALLBACK_PATH)\n    else:\n        raise","preventionTips":["Use explicit 'repo_id:filename' to avoid guessing default filenames","Set HF_TOKEN for private/gated repos; pre-download in CI"],"tags":["realesrgan","huggingface","download","postprocess"],"backgroundTag":"model-download-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}