Skip to content

fix(kernels): check HTTP status when downloading outputs - #1176

Merged
stevemessick merged 1 commit into
Kaggle:mainfrom
sridipbasu:fix/kernels-output-http-error
Aug 20, 2026
Merged

fix(kernels): check HTTP status when downloading outputs#1176
stevemessick merged 1 commit into
Kaggle:mainfrom
sridipbasu:fix/kernels-output-http-error

Conversation

@sridipbasu

Copy link
Copy Markdown
Collaborator

Summary

When running kaggle kernels output, the CLI downloads each output file from a signed storage URL. The response from that request was written directly to the output file without checking the HTTP status first.

Because of this, if the storage request returned an error such as 403 or 5xx, the error response itself could be saved as the output file. The CLI would then print that the file was downloaded successfully even though the file actually contained the error response.

This was especially problematic for scripts or automated workflows that rely on the command succeeding and then use the downloaded file.

Fix

Added raise_for_status() after the storage request so failed downloads are stopped before anything is written to disk.

The existing CLI error handling already handles HTTPError, so no other changes to the download flow were needed.

Also added a regression test to make sure a failed download raises the expected error and does not create the output file.

Tests

Added a test covering a failed output file download with a 403 response.

Ran:

pytest tests/unit/test_kernels_logs.py::TestKernelsLogs::test_kernels_output_failed_download_is_not_written -v

pytest tests/unit/test_kernels_logs.py -k "output" -v

pytest tests/unit -q

The regression test was also verified to fail before the fix and pass after the fix.

All unit tests pass with 1289 tests passing.

@google-cla

google-cla Bot commented Aug 15, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@sridipbasu
sridipbasu force-pushed the fix/kernels-output-http-error branch from a9a487c to 897040c Compare August 15, 2026 16:02
@sridipbasu

Copy link
Copy Markdown
Collaborator Author

@google-cla
cc: @stevemessick
Just wanted to clarify: I mistakenly did this from another account. I corrected the commit author and pushed the same content from my sridipbasu account, so nothing changed in the implementation.

@sridipbasu
sridipbasu marked this pull request as draft August 15, 2026 17:43
@sridipbasu
sridipbasu marked this pull request as ready for review August 16, 2026 12:50
@stevemessick

Copy link
Copy Markdown
Contributor

/gcbrun

@sridipbasu sridipbasu added the bug Something isn't working label Aug 20, 2026
@stevemessick

Copy link
Copy Markdown
Contributor

Great! Thanks, again.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants