diff --git a/src/main/services/projectCustomizationWatcher.ts b/src/main/services/projectCustomizationWatcher.ts index afc2bd3..72b79e1 100644 --- a/src/main/services/projectCustomizationWatcher.ts +++ b/src/main/services/projectCustomizationWatcher.ts @@ -169,7 +169,14 @@ async function collectExistingDirectories(rootPath: string): Promise { } function createProjectWatchHandle(directoryPath: string, onChange: () => void): ProjectWatchHandle { - return watch(directoryPath, { persistent: false }, () => { + const watcher = watch(directoryPath, { persistent: false }, () => { onChange(); }); + + watcher.on('error', (error) => { + console.warn(`[aryx customization] Watcher error for ${directoryPath}:`, error); + watcher.close(); + }); + + return watcher; }