[GH-ISSUE #4] [Bug]: commit OIDs too long for huggingface hub compatibility #4

Closed
opened 2026-04-10 16:03:07 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @LenDigLearn on GitHub (Nov 12, 2025).
Original GitHub issue: https://github.com/KohakuBlueleaf/KohakuHub/issues/4

What's wrong?

I tried to upload a dataset to KohakuHub as follows:

dataset = Dataset.load_from_disk("dataset_path")
repo_id="MyOrg/MyRepo"
dataset.push_to_hub(repo_id)

Environment variables for endpoint and token were of course set correctly.

When running above code, I get the following error:

...hf_api.py", line 4072, in create_commit
    raise ValueError(
        f"`parent_commit` is not a valid commit OID. It must match the following regex: {constants.REGEX_COMMIT_OID}"
    )
ValueError: `parent_commit` is not a valid commit OID. It must match the following regex: re.compile('[A-Fa-f0-9]{5,40}')

I checked manually, the commit ID returned from KohakuHub is 64 characters, so re.fullmatch fails since it is too long.

Looking at the code, it seems right now the commit IDs generated by LakeFS are directly used. I think either some mapping or truncation of commit IDs would be required to make it fully compatible.

Environment

  • OS: Linux
  • Deployment: Docker as per readme

Logs (if available)

ValueError: `parent_commit` is not a valid commit OID. It must match the following regex: re.compile('[A-Fa-f0-9]{5,40}')

Checklist

  • I searched existing issues
Originally created by @LenDigLearn on GitHub (Nov 12, 2025). Original GitHub issue: https://github.com/KohakuBlueleaf/KohakuHub/issues/4 ### What's wrong? I tried to upload a dataset to KohakuHub as follows: ```python dataset = Dataset.load_from_disk("dataset_path") repo_id="MyOrg/MyRepo" dataset.push_to_hub(repo_id) ``` Environment variables for endpoint and token were of course set correctly. When running above code, I get the following error: ``` ...hf_api.py", line 4072, in create_commit raise ValueError( f"`parent_commit` is not a valid commit OID. It must match the following regex: {constants.REGEX_COMMIT_OID}" ) ValueError: `parent_commit` is not a valid commit OID. It must match the following regex: re.compile('[A-Fa-f0-9]{5,40}') ``` I checked manually, the commit ID returned from KohakuHub is 64 characters, so re.fullmatch fails since it is too long. Looking at the code, it seems right now the commit IDs generated by LakeFS are directly used. I think either some mapping or truncation of commit IDs would be required to make it fully compatible. ### Environment - OS: Linux - Deployment: Docker as per readme ### Logs (if available) ```shell ValueError: `parent_commit` is not a valid commit OID. It must match the following regex: re.compile('[A-Fa-f0-9]{5,40}') ``` ### Checklist - [x] I searched existing issues
GiteaMirror added the bug label 2026-04-10 16:03:07 -05:00
Author
Owner

@LenDigLearn commented on GitHub (Nov 12, 2025):

HF Hub expects git-style commit IDs (SHA-1), LakeFS uses SHA-256.

A quick and dirty way would be to truncate the returned hash here:

0d3167ed94/src/kohakuhub/api/repo/routers/info.py (L238)

"sha": commit_id[:40],

I tried this locally and it seems to work.

<!-- gh-comment-id:3521214394 --> @LenDigLearn commented on GitHub (Nov 12, 2025): HF Hub expects git-style commit IDs (SHA-1), LakeFS uses SHA-256. A quick and dirty way would be to truncate the returned hash here: https://github.com/KohakuBlueleaf/KohakuHub/blob/0d3167ed94eaa8cd6e8d46d12d100f4f671ae52e/src/kohakuhub/api/repo/routers/info.py#L238 ```python "sha": commit_id[:40], ``` I tried this locally and it seems to work.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/KohakuHub#4