fix: skip unreadable files during indexing instead of crashing
On macOS with iCloud Drive (especially shared folders), some files may appear in the filesystem but return EAGAIN (error -11) when read via Node's readFileSync. This happens when iCloud has evicted the file content but the file metadata remains visible. Previously this crashed the entire update process. Now we catch the error and skip the file, allowing the remaining files to index successfully. Affects: iCloud Drive shared folders on macOS Error: 'Unknown system error -11: Unknown system error -11, read' Reproduces with: Node.js v25.x, readFileSync on evicted iCloud files
This commit is contained in:
parent
d1ec31eab8
commit
32cd83b470
10
src/qmd.ts
10
src/qmd.ts
@ -1455,7 +1455,15 @@ async function indexFiles(pwd?: string, globPattern: string = DEFAULT_GLOB, coll
|
||||
const path = handelize(relativeFile); // Normalize path for token-friendliness
|
||||
seenPaths.add(path);
|
||||
|
||||
const content = readFileSync(filepath, "utf-8");
|
||||
let content: string;
|
||||
try {
|
||||
content = readFileSync(filepath, "utf-8");
|
||||
} catch (err: any) {
|
||||
// Skip files that can't be read (e.g. iCloud evicted files returning EAGAIN)
|
||||
processed++;
|
||||
progress.set((processed / total) * 100);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip empty files - nothing useful to index
|
||||
if (!content.trim()) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user