From 644b45942f7f51ff7f80feab291569b56979cf2c Mon Sep 17 00:00:00 2001 From: Diego Serrano <129707357+diegoserranobst@users.noreply.github.com> Date: Tue, 14 Apr 2026 07:28:32 -0400 Subject: [PATCH] fix(watcher): ignore transient ENOENT on ephemeral .lock files --- src/main/services/infrastructure/FileWatcher.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/services/infrastructure/FileWatcher.ts b/src/main/services/infrastructure/FileWatcher.ts index 14b888e0..fe90e437 100644 --- a/src/main/services/infrastructure/FileWatcher.ts +++ b/src/main/services/infrastructure/FileWatcher.ts @@ -485,7 +485,14 @@ export class FileWatcher extends EventEmitter { watcher: fs.FSWatcher, watcherType: 'projects' | 'todos' | 'teams' | 'tasks' ): void { - watcher.on('error', (error) => { + watcher.on('error', (error: NodeJS.ErrnoException) => { + // Ephemeral .lock files cause harmless ENOENT when the recursive watcher + // tries to scandir a path that was already deleted. Log as debug and skip + // the teardown/retry — the watcher is still healthy. + if (error.code === 'ENOENT' && error.path?.endsWith('.lock')) { + logger.debug(`FileWatcher: ${watcherType} ignoring transient ENOENT on lock file`); + return; + } logger.error(`FileWatcher: ${watcherType} watcher error:`, error); if (watcherType === 'projects') { this.projectsWatcher = null;