someone-in-the-world Claude Sonnet 4.6 commited on
Commit
f152e6e
·
1 Parent(s): 28748fe

Handle empty dataset repo in _list_existing_files

Browse files

Catch the 404 EntryNotFoundError thrown when the repo has no commits yet
(data/ path does not exist on main), log it, and return [] so the first
commit can proceed normally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. logging_utils.py +9 -5
logging_utils.py CHANGED
@@ -86,11 +86,15 @@ def _make_path(now, uid):
86
 
87
 
88
  def _list_existing_files(api, repo_id):
89
- return sorted(
90
- f.path
91
- for f in api.list_repo_tree(repo_id, repo_type="dataset", path_in_repo="data")
92
- if f.path.endswith(".parquet")
93
- )
 
 
 
 
94
 
95
 
96
  def _build_add_ops(batch):
 
86
 
87
 
88
  def _list_existing_files(api, repo_id):
89
+ try:
90
+ return sorted(
91
+ f.path
92
+ for f in api.list_repo_tree(repo_id, repo_type="dataset", path_in_repo="data")
93
+ if f.path.endswith(".parquet")
94
+ )
95
+ except Exception as e:
96
+ print(f"[log] could not list existing files (empty repo?): {e}")
97
+ return []
98
 
99
 
100
  def _build_add_ops(batch):