Fix set_space_volumes sending bare array instead of object#4054
Merged
hanouticelina merged 1 commit intomainfrom Apr 6, 2026
Merged
Fix set_space_volumes sending bare array instead of object#4054hanouticelina merged 1 commit intomainfrom
hanouticelina merged 1 commit intomainfrom
Conversation
The PUT /api/spaces/{repo_id}/volumes endpoint expects a JSON object
with a "volumes" key, but the client was sending a bare JSON array.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
hanouticelina
approved these changes
Apr 6, 2026
Contributor
There was a problem hiding this comment.
thanks for fixing it!
for reference, the input specs for /api/:repoType(spaces)/:namespace/:repo/volumes are here (private link).
hanouticelina
pushed a commit
that referenced
this pull request
Apr 7, 2026
The PUT /api/spaces/{repo_id}/volumes endpoint expects a JSON object
with a "volumes" key, but the client was sending a bare JSON array.
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
|
we've just released a patch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes
set_space_volumeswhich currently sends a bare JSON array toPUT /api/spaces/{repo_id}/volumes, but the endpoint expects a JSON object with a"volumes"key.Before (fails with 400):
After (works):
How was this found?
Calling
api.set_space_volumes()returns:How was the fix verified?
I tested both payload formats directly against the production endpoint:
Caveat
I inferred the expected payload format from the error message and empirical testing. I didn't check the server-side API spec, so it's possible the fix should be on the server side (accepting arrays) rather than the client side. Happy to adjust if the intended contract is different from what I've assumed here.
Note
Low Risk
Low risk, single-request payload shape change to match the server contract for
PUT /api/spaces/{repo_id}/volumes. Main risk is compatibility if any server deployment previously accepted a bare array.Overview
Fixes
HfApi.set_space_volumesto wrap the serialized volumes list in a JSON object ({"volumes": [...]}) instead of sending a bare array, aligning the client payload with whatPUT /api/spaces/{repo_id}/volumesexpects.Reviewed by Cursor Bugbot for commit 22690f6. Bugbot is set up for automated code reviews on this repo. Configure here.