fix: handle FileNotFoundError gracefully during sync · basicmachines-co/basic-memory@1652f86 · GitHub
Skip to content

Commit 1652f86

Browse files
phernandezclaude
andcommitted
fix: handle FileNotFoundError gracefully during sync
When a file exists in the database but is missing from the filesystem, the sync worker now treats this as a deletion instead of crashing. The sync_file() method catches FileNotFoundError specifically and calls handle_delete() to clean up the orphaned database record. This prevents the sync from failing on database/filesystem inconsistencies that can occur due to race conditions, manual file deletions, or cloud storage caching issues. Includes a test to verify the graceful handling behavior. Fixes #386 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
1 parent c23927d commit 1652f86

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

src/basic_memory/sync/sync_service.py

Lines changed: 10 additions & 0 deletions

tests/sync/test_sync_service.py

Lines changed: 60 additions & 0 deletions

0 commit comments

Comments
 (0)