diff --git a/src/services/git-clone.ts b/src/services/git-clone.ts index 7924462521..8d46273774 100644 --- a/src/services/git-clone.ts +++ b/src/services/git-clone.ts @@ -146,7 +146,15 @@ export const cloneRepository = async ( */ const readAllFiles = async (baseDir: string, currentDir: string): Promise => { const files: FileEntry[] = []; - const entries = await pfs.readdir(currentDir); + + let entries: string[]; + try { + entries = await pfs.readdir(currentDir); + } catch (err) { + // Directory might not exist or be inaccessible + console.warn(`Cannot read directory: ${currentDir}`); + return files; + } for (const entry of entries) { // Skip .git directory @@ -158,7 +166,17 @@ const readAllFiles = async (baseDir: string, currentDir: string): Promise