Skip to content

fix(fs): handle ENOENT in readDirectoryRecursive and bridge providers#1450

Merged
IceyLiu merged 1 commit intomainfrom
fix/enoent-unhandled-rejection
Mar 19, 2026
Merged

fix(fs): handle ENOENT in readDirectoryRecursive and bridge providers#1450
IceyLiu merged 1 commit intomainfrom
fix/enoent-unhandled-rejection

Conversation

@kaizhou-lab
Copy link
Copy Markdown
Collaborator

Summary

  • Add try/catch around fs.stat() calls in readDirectoryRecursive() to handle deleted temp workspaces (gemini-temp-*, claude-temp-*) and race conditions where files are removed between readdir and stat
  • Harden bridge providers (getFilesByDir, getFileMetadata, getWorkspace) to never throw — the bridge library's provider callback has no .catch handler, so any thrown error becomes an unhandled promise rejection reported to Sentry
  • Add 7 unit tests covering ENOENT scenarios and race conditions

Test plan

  • readDirectoryRecursive returns null for non-existent directory
  • readDirectoryRecursive returns null for cleaned-up temp workspace
  • readDirectoryRecursive skips files deleted between readdir and stat
  • All 857 existing tests pass

Fixes ELECTRON-5Y, ELECTRON-5Z, ELECTRON-60, ELECTRON-61, ELECTRON-62
Closes #1434, #1436, #1437, #1438, #1439

Add try/catch around fs.stat() calls in readDirectoryRecursive() to
handle deleted temp workspaces (gemini-temp-*, claude-temp-*) and race
conditions where files are removed between readdir and stat.

Also harden bridge providers (getFilesByDir, getFileMetadata,
getWorkspace) to never throw, since the bridge library's provider
callback has no .catch handler — any thrown error becomes an unhandled
promise rejection reported to Sentry.

Fixes ELECTRON-5Y, ELECTRON-5Z, ELECTRON-60, ELECTRON-61, ELECTRON-62
Closes #1434, #1436, #1437, #1438, #1439
@IceyLiu IceyLiu merged commit b099dd7 into main Mar 19, 2026
15 of 17 checks passed
@piorpua piorpua deleted the fix/enoent-unhandled-rejection branch March 19, 2026 08:20
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.

Error: ENOENT: no such file or directory, stat 'C:\Users\tiang\AppData\Roaming\AionUi\aionui\gemini-temp-1773903342359\系统模块接口文档.md'

2 participants