p-e-w/heretic · error · RuntimeError

Could not fetch uploaded model hashes.

Error message

Could not fetch uploaded model hashes.

What it means

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.

Source

Thrown at src/heretic/main.py:1273

                                        ),
                                    )
                                finally:
                                    settings.export_strategy = current_export_strategy

                            print(f"Model uploaded to [bold]{repo_id}[/].")

                            if reproduction_mode:
                                print("Verifying hashes of weight files...")

                                api = HfApi()
                                model_info = api.model_info(
                                    repo_id,
                                    files_metadata=True,
                                    token=token,
                                )

                                if not model_info.siblings:
                                    raise RuntimeError(
                                        "Could not fetch uploaded model hashes."
                                    )

                                for (
                                    filename,
                                    original_sha256,
                                ) in reproduction_information["hashes"].items():
                                    file_found = False

                                    for file in model_info.siblings:
                                        if file.rfilename == filename:
                                            sha256 = getattr(file, "lfs", {}).get(
                                                "sha256"
                                            )
                                            if not sha256:
                                                raise RuntimeError(
                                                    "Could not fetch uploaded model hashes."
                                                )

View on GitHub (pinned to bedb94ef11)

Solutions

  1. Retry model_info after a short delay (Hub metadata may lag the upload)
  2. Verify repo_id and that the upload actually succeeded (list repo files via the Hub UI or list_repo_files)
  3. Check the token's permissions and pass the correct token
  4. Re-run the upload if the repo is genuinely empty

Example fix

// before
model_info = api.model_info(repo_id, files_metadata=True, token=token)
// after
for attempt in range(3):
    model_info = api.model_info(repo_id, files_metadata=True, token=token)
    if model_info.siblings:
        break
    time.sleep(5 * (attempt + 1))
else:
    raise RuntimeError("Could not fetch uploaded model hashes.")
Defensive patterns

Strategy: retry

Validate before calling

info = api.model_info(repo_id, token=token)
if not info.siblings:
    raise RuntimeError(f"Repo {repo_id} has no files; upload may have failed")

Type guard

def has_files(info) -> bool:
    return bool(getattr(info, "siblings", None))

Try / catch

for attempt in range(5):
    try:
        info = api.model_info(repo_id, files_metadata=True, token=token)
        if info.siblings:
            break
    except Exception:
        pass
    time.sleep(2 ** attempt)
else:
    raise RuntimeError("Could not fetch uploaded model hashes.")

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of p-e-w/heretic@bedb94ef11 (2026-08-29). Data as JSON: /api/errors/c25be09c162f6085. Report an issue: GitHub.