Skip to content

fix: list_kernel_files returns 0 files (issue #51)#54

Open
1chooo wants to merge 1 commit into
Kaggle:mainfrom
1chooo:fix/list-kernel-files-returns-zero
Open

fix: list_kernel_files returns 0 files (issue #51)#54
1chooo wants to merge 1 commit into
Kaggle:mainfrom
1chooo:fix/list-kernel-files-returns-zero

Conversation

@1chooo

@1chooo 1chooo commented Jun 27, 2026

Copy link
Copy Markdown

Summary

  • Root cause 1 — wrong API: list_kernel_files returns kernel source files, not run output artifacts. Users expecting output files (CSVs, model weights, etc.) should use list_kernel_session_output instead. Added clear docstrings to both methods and both request types explaining the distinction.
  • Root cause 2 — silent empty response: user_name and kernel_slug default to "" and are silently omitted from the request body, causing the server to return "files": [] with no error. Both methods now raise ValueError with a descriptive message (including a pointer to the correct API) when either field is missing.
  • Root cause 3 — latent crash on null response: If the server ever returns "files": null, set_from_dict in kaggle_object.py would crash with TypeError inside ListSerializer. None is now treated the same as the default empty list.

Test plan

  • Call list_kernel_files without setting user_name/kernel_slug — expect ValueError with a message mentioning list_kernel_session_output.
  • Call list_kernel_session_output without setting user_name/kernel_slug — expect ValueError with a message mentioning list_kernel_files.
  • Call list_kernel_files with valid user_name and kernel_slug — expect normal file list response.
  • Simulate a server response with "files": null — expect empty list, no crash.

Closes #51

Made with Cursor

Three root causes addressed:

1. Silent empty response when user_name/kernel_slug are omitted — add
   ValueError in list_kernel_files and list_kernel_session_output when
   either required field is missing, with a hint pointing to the correct
   API.

2. API confusion — list_kernel_files returns kernel source files, not
   run output artifacts. Add docstrings to both methods and both request
   types making this distinction explicit and cross-referencing each other.

3. Latent crash on `"files": null` in server response — set_from_dict
   in kaggle_object.py now treats None values the same as the default,
   preventing a TypeError from ListSerializer trying to iterate None.

Fixes Kaggle#51
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.

Kernel List Files Return 0 file

1 participant