Skip to content

Raise errors when documents fail to add to dataset#50

Merged
stevevanhooser merged 2 commits into
mainfrom
claude/dataset-document-error-handling-Cntyn
Mar 25, 2026
Merged

Raise errors when documents fail to add to dataset#50
stevevanhooser merged 2 commits into
mainfrom
claude/dataset-document-error-handling-Cntyn

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Summary

  • Four locations in the download/dataset code were silently swallowing exceptions (except: pass) when documents failed to convert or be added to the database, causing datasets to have fewer documents than expected with zero indication of what went wrong
  • jsons2documents() now warns with specific document IDs and error messages for each conversion failure
  • ndi_dataset_dir.__init__(), downloadDataset(), _sync_download_new(), and add_ingested_session() now raise RuntimeError with details when any documents are lost (duplicate FileExistsError is still safely skipped)

Context

When downloading a dataset with 7221 documents, only 7123 ended up in the dataset — 98 documents were silently dropped. This was caused by bare except: pass blocks in the conversion and database-add paths.

Test plan

  • All 1545 existing tests pass
  • Download a dataset and verify that all documents are present, or a clear error is raised listing the failed document IDs

https://claude.ai/code/session_015oe6ucKwCFznpu1PN1nAfz

claude added 2 commits March 25, 2026 15:36
…wnload

Four locations were silently swallowing exceptions (except: pass) when
documents failed to convert or be added to the dataset database. This caused
downloaded datasets to have fewer documents than expected with no indication
of what went wrong.

Changes:
- jsons2documents(): warn with document IDs and error details for each
  conversion failure
- ndi_dataset_dir.__init__(): raise RuntimeError when documents fail to add
  to the database (FileExistsError for duplicates is still silently skipped)
- downloadDataset(): raise RuntimeError at the end if any documents were lost
  during conversion or database insertion
- _sync_download_new(): raise RuntimeError when sync loses documents
- add_ingested_session(): raise RuntimeError instead of DEBUG-only logging

https://claude.ai/code/session_015oe6ucKwCFznpu1PN1nAfz
@stevevanhooser stevevanhooser merged commit 6cd2d36 into main Mar 25, 2026
5 checks passed
@stevevanhooser stevevanhooser deleted the claude/dataset-document-error-handling-Cntyn branch March 25, 2026 15:52
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