{"record":{"id":"c25be09c162f6085","repo":"p-e-w/heretic","slug":"could-not-fetch-uploaded-model-hashes","errorCode":null,"errorMessage":"Could not fetch uploaded model hashes.","messagePattern":"Could not fetch uploaded model hashes\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/heretic/main.py","lineNumber":1273,"sourceCode":"                                        ),\n                                    )\n                                finally:\n                                    settings.export_strategy = current_export_strategy\n\n                            print(f\"Model uploaded to [bold]{repo_id}[/].\")\n\n                            if reproduction_mode:\n                                print(\"Verifying hashes of weight files...\")\n\n                                api = HfApi()\n                                model_info = api.model_info(\n                                    repo_id,\n                                    files_metadata=True,\n                                    token=token,\n                                )\n\n                                if not model_info.siblings:\n                                    raise RuntimeError(\n                                        \"Could not fetch uploaded model hashes.\"\n                                    )\n\n                                for (\n                                    filename,\n                                    original_sha256,\n                                ) in reproduction_information[\"hashes\"].items():\n                                    file_found = False\n\n                                    for file in model_info.siblings:\n                                        if file.rfilename == filename:\n                                            sha256 = getattr(file, \"lfs\", {}).get(\n                                                \"sha256\"\n                                            )\n                                            if not sha256:\n                                                raise RuntimeError(\n                                                    \"Could not fetch uploaded model hashes.\"\n                                                )","sourceCodeStart":1255,"sourceCodeEnd":1291,"githubUrl":"https://github.com/p-e-w/heretic/blob/bedb94ef117a271532ac2058447fbc165d5051bd/src/heretic/main.py#L1255-L1291","documentation":"After uploading a model to the Hugging Face Hub, `run` fetches model_info with files_metadata=True to read LFS SHA-256 hashes of uploaded files. If the Hub returns no siblings (files), verification of the upload is impossible, so it raises. This guards against silently skipping hash verification of a corrupted or empty upload.","triggerScenarios":"Calling HfApi.model_info(repo_id, files_metadata=True, token=token) right after upload and receiving a response with an empty/None siblings list — e.g. wrong repo_id, upload that actually wrote zero files, or Hub API returning a degraded/partial response.","commonSituations":"Transient Hub API issues immediately after upload (eventual consistency), incorrect repo_id (typo or wrong namespace), or an authenticated token lacking access to the repo.","solutions":["Retry model_info after a short delay (Hub metadata may lag the upload)","Verify repo_id and that the upload actually succeeded (list repo files via the Hub UI or list_repo_files)","Check the token's permissions and pass the correct token","Re-run the upload if the repo is genuinely empty"],"exampleFix":"// before\nmodel_info = api.model_info(repo_id, files_metadata=True, token=token)\n// after\nfor attempt in range(3):\n    model_info = api.model_info(repo_id, files_metadata=True, token=token)\n    if model_info.siblings:\n        break\n    time.sleep(5 * (attempt + 1))\nelse:\n    raise RuntimeError(\"Could not fetch uploaded model hashes.\")\n","handlingStrategy":"retry","validationCode":"info = api.model_info(repo_id, token=token)\nif not info.siblings:\n    raise RuntimeError(f\"Repo {repo_id} has no files; upload may have failed\")","typeGuard":"def has_files(info) -> bool:\n    return bool(getattr(info, \"siblings\", None))","tryCatchPattern":"for attempt in range(5):\n    try:\n        info = api.model_info(repo_id, files_metadata=True, token=token)\n        if info.siblings:\n            break\n    except Exception:\n        pass\n    time.sleep(2 ** attempt)\nelse:\n    raise RuntimeError(\"Could not fetch uploaded model hashes.\")","preventionTips":["Retry metadata fetches after uploads (Hub eventual consistency)","Verify repo_id and token scope before uploading","Confirm the upload created files (list_repo_files) before verification"],"tags":["network","huggingface","upload"],"backgroundTag":"hub-metadata-fetch-failed","analyzedSha":"bedb94ef117a271532ac2058447fbc165d5051bd","analyzedAt":"2026-08-29T08:38:06.692Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}