Merge pull request #253 from jimmynail/fix/skip-unreadable-files

fix: skip unreadable files during indexing instead of crashing
This commit is contained in:
Tobias Lütke 2026-03-07 14:25:11 -04:00 committed by GitHub
commit 271feb7791
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1452,7 +1452,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()) {