Skip to content

fix(cli): prevent silent partial uploads on upload failure - #1150

Merged
stevemessick merged 1 commit into
Kaggle:mainfrom
sridipbasu:fix/upload-failure-aborts-create
Jul 29, 2026
Merged

fix(cli): prevent silent partial uploads on upload failure#1150
stevemessick merged 1 commit into
Kaggle:mainfrom
sridipbasu:fix/upload-failure-aborts-create

Conversation

@sridipbasu

Copy link
Copy Markdown
Contributor

Summary

When creating a dataset or model version, a failed file upload could be silently ignored. If _upload_blob() returned None—either because the upload failed or because all resume attempts were exhausted—the file was skipped, the create request still went through, and the CLI reported success. This could result in a dataset or model version being created with one or more missing files.

This change makes upload failures abort the operation instead of creating a partial upload.

Fix

  • Raise a ValueError when a file upload fails instead of returning None.
  • Prevent dataset/model version creation if any file upload fails.
  • Added a separate EXPIRED upload state for resumable uploads whose session can no longer be resumed.
  • Restart the upload only when the session can no longer be resumed (for example, an expired upload session). A FAILED result still gives up, since the server rejected the upload and restarting would only hit the same error.
  • Updated the upload status documentation to match the implemented behavior.

Behavior change

Since _upload_file() is shared, this also affects two other commands:

  • kaggle competitions data update now aborts if any file upload fails instead of creating a partial data version.
  • kaggle files upload now aborts if a file upload fails instead of skipping the failed file and continuing.

The CLI now exits with a non-zero status when an upload fails, making these failures visible to automation.

Tests

Added regression tests to verify that:

  • Dataset creation aborts when any file upload fails.
  • Model version creation aborts when any file upload fails.
  • Failed uploads are no longer silently skipped.
  • Expired upload sessions start a new upload instead of reusing the old session.
  • Existing successful upload behavior continues to work.

Ran:

  • pytest tests/unit/test_upload_helpers.py
  • pytest tests/unit/test_dataset_create.py
  • pytest tests/unit/test_model_create.py

Also ran the full unit test suite to verify there were no regressions.

@stevemessick

Copy link
Copy Markdown
Contributor

/gcbrun

@stevemessick

Copy link
Copy Markdown
Contributor

Thanks!

@stevemessick
stevemessick merged commit b6ba0a7 into Kaggle:main Jul 29, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants