Repository navigation
fix(cli): exit non-zero when dataset, kernel, and model write commands fail - #1243
Merged
stevemessick merged 1 commit intoNov 12, 2026
Merged
Conversation
stevemessick
approved these changes
Nov 12, 2026
stevemessick
left a comment
Contributor
There was a problem hiding this comment.
Glad to see more consistency.
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.
Summary
While looking at the
kaggle datasets createflow, I found that the command exits with code0when the server rejects the request.For example, creating a dataset with an invalid slug prints:
but the command still exits with code
0, so scripts and CI jobs treat the failure as a success.The issue was that the
*_cliwrappers print the server'serrorfield instead of raising an error. The same pattern exists in 11 write commands:datasets create,datasets versionkernels push(and its aliaskernels update)models create,models update,models deletemodels instances create,models instances update,models instances deletemodels instances versions create,models instances versions deleteUsers have reported these error messages in #255, #416 and #321. Those failures come from the server, so this PR does not resolve them, but with this change such failures are no longer reported as successful.
Fix
I updated the 11 CLI wrappers to raise a
ValueErrorwith the same message instead of printing it. This uses the existing error handling inmain(), so the CLI now prints the error to stderr and exits with code1. This follows the same approach as #1215.The Python library methods (
dataset_create_new(),kernels_push(),model_create_new(), etc.) remain unchanged and still return the response with itserrorfield.Warnings for partial success, such as invalid tags or data sources on
kernels push, are unchanged and still exit with code0.Tests
Added
tests/unit/test_cli_write_errors.py, which checks that each of the 11 wrappers raises aValueErrorcontaining the server error.All 11 subtests fail with the old implementation and pass with this fix.
Ran:
Results:
Also ran the Black check, which passed.
I also verified this against the live API with
kaggle datasets createusing an invalid slug. The command now prints the error to stderr and exits with code1instead of0. No dataset was created.This change is limited to CLI error handling. It does not modify the Python library API, the API requests, or any waiting and polling flow.