{"record":{"id":"3a497ff3e85e3ce8","repo":"p-e-w/heretic","slug":"could-not-fetch-uploaded-model-hashes-3a497f","errorCode":null,"errorMessage":"Could not fetch uploaded model hashes.","messagePattern":"Could not fetch uploaded model hashes\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"src/heretic/utils.py","lineNumber":707,"sourceCode":"    # Copy Optuna study journal.\n    checkpoint_file = Path(checkpoint_path)\n    if checkpoint_file.exists():\n        (reproduce_dir / checkpoint_file.name).write_bytes(checkpoint_file.read_bytes())\n\n\ndef upload_reproduce_folder(\n    repo_id: str,\n    settings: Settings,\n    token: str,\n    checkpoint_path: str | Path,\n    trial: Trial | FrozenTrial,\n    include_system_information: bool,\n):\n    api = huggingface_hub.HfApi()\n    info = api.model_info(repo_id=repo_id, files_metadata=True, token=token)\n\n    if not info.siblings:\n        raise RuntimeError(\"Could not fetch uploaded model hashes.\")\n\n    # For weights, we only care about safetensors.\n    weight_extensions = (\".safetensors\",)\n\n    uploaded_model_hashes = {}\n\n    for file in info.siblings:\n        if file.rfilename.endswith(weight_extensions):\n            sha256 = getattr(file, \"lfs\", {}).get(\"sha256\")\n            if not sha256:\n                raise RuntimeError(\"Could not fetch uploaded model hashes.\")\n            uploaded_model_hashes[file.rfilename] = sha256\n\n    with tempfile.TemporaryDirectory() as tmpdir:\n        tmp_path = Path(tmpdir)\n        create_reproduce_folder(\n            tmp_path,\n            settings,","sourceCodeStart":689,"sourceCodeEnd":725,"githubUrl":"https://github.com/p-e-w/heretic/blob/bedb94ef117a271532ac2058447fbc165d5051bd/src/heretic/utils.py#L689-L725","documentation":"upload_reproduce_folder fetches the uploaded model's file metadata (including LFS hashes) from the Hugging Face Hub via api.model_info. If the response has no file siblings at all, it cannot compute the model hash comparison needed for the reproduction record and raises this RuntimeError.","triggerScenarios":"api.model_info returns info with an empty/None siblings list — e.g. the repo exists but has no visible files, wrong repo_id, or insufficient token permissions to list files.","commonSituations":"Typos in repo_id, a private repo accessed with an expired or unauthorized token, uploading to a repo that failed to receive files, or Hub API glitches.","solutions":["Verify repo_id and that the model upload completed successfully before calling upload_reproduce_folder.","Pass a valid HF token with read access to the repo (token parameter or logged-in account).","Re-run the upload; check the repo's Files tab on the Hub actually contains safetensors weights."],"exampleFix":"// before\napi.upload_file(...)  # upload that silently failed\nupload_reproduce_folder(...)\n// after\napi.upload_large_folder(repo_id=repo_id, folder_path=..., repo_type=\"model\")\ninfo = huggingface_hub.HfApi().model_info(repo_id, files_metadata=True, token=token)\nassert info.siblings, \"upload produced no files\"\nupload_reproduce_folder(...)","handlingStrategy":"try-catch","validationCode":"api = huggingface_hub.HfApi(token=token)\ninfo = api.model_info(repo_id=repo_id, files_metadata=True, token=token)\nif not info.siblings:\n    raise RuntimeError(f\"Repo {repo_id} has no visible files; check upload/token\")","typeGuard":"def model_files_are_listable(info) -> bool:\n    return bool(info and info.siblings)","tryCatchPattern":"try:\n    upload_reproduce_folder(...)\nexcept RuntimeError as e:\n    if str(e) == \"Could not fetch uploaded model hashes.\":\n        print(\"Verify repo_id, token permissions, and that the upload completed\")\n    else:\n        raise","preventionTips":["Confirm upload success (list repo files) before building the reproduce folder.","Use a token with read access to the target repo.","Retry model_info on transient Hub errors."],"tags":["network","huggingface","api"],"backgroundTag":"hf-model-metadata-missing","analyzedSha":"bedb94ef117a271532ac2058447fbc165d5051bd","analyzedAt":"2026-08-29T08:38:06.692Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}