{"record":{"id":"85a24831323d3476","repo":"windmill-labs/windmill","slug":"error-reading-dir-localp-e","errorCode":null,"errorMessage":"Error reading dir: ${localP}, ${e}","messagePattern":"Error reading dir: (.+?), (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/src/commands/sync/sync.ts","lineNumber":704,"sourceCode":"    isDir: boolean,\n    codebases: SyncCodebase[],\n  ): DynFSElement {\n    return {\n      isDirectory: isDir,\n      path: localP.substring(p.length + 1),\n      async *getChildren(): AsyncIterable<DynFSElement> {\n        if (!isDir) return [];\n        try {\n          const entries = await readdir(localP, { withFileTypes: true });\n          for (const e of entries) {\n            yield _internal_element(\n              path.join(localP, e.name),\n              e.isDirectory(),\n              codebases,\n            );\n          }\n        } catch (e) {\n          log.warn(`Error reading dir: ${localP}, ${e}`);\n        }\n      },\n      async getContentText(): Promise<string> {\n        const itemPath = localP.substring(p.length + 1);\n        // BEFORE the read: an oversized dbt project file stays visible to the\n        // diff on purpose (so the push reports it rather than silently shipping\n        // an incomplete project), and buffering a multi-gigabyte seed to reach\n        // that error is what this refusal exists to avoid.\n        const oversized = oversizedDbtFileError(localP, itemPath);\n        if (oversized) throw oversized;\n        const content = await readTextFile(localP);\n        const r = await addCodebaseDigestIfRelevant(\n          itemPath,\n          content,\n          codebases,\n          ignoreCodebaseChanges,\n        );\n        return r;","sourceCodeStart":686,"sourceCodeEnd":722,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/sync/sync.ts#L686-L722","documentation":"A warning emitted by getChildren while building the local file tree during `wmill sync`. When reading one directory entry of the local folder fails (e.g. permission error, symlink target missing, file deleted mid-walk), the CLI logs the error and skips that subtree rather than aborting the whole sync.","triggerScenarios":"A subdirectory or file under the sync root cannot be read by `fs.readdir`/entry traversal: restrictive permissions, a broken symlink, a path removed between listing and recursion (race), or an OS-level I/O error.","commonSituations":"Running the CLI as a user without read access to part of the repo; node_modules or build output with broken symlinks; files deleted by another process (editor cleanup, git checkout) while sync runs; encrypted/network mounts going stale.","solutions":["Fix filesystem permissions on the reported path (`chmod`/`chown`) so the running user can read it.","Remove or repair broken symlinks inside the sync directory.","Exclude the problematic path from sync (delete it, or restructure so it lives outside the sync root).","Re-run the sync — if it was a transient race with another process, a retry succeeds."],"exampleFix":"// before\n$ wmill sync pull\n⚠️  Error reading dir: /repo/scripts/generated, EACCES: permission denied\n// after\n$ sudo chmod -R u+rX /repo/scripts/generated\n$ wmill sync pull   # proceeds without warning","handlingStrategy":"validation","validationCode":"import { accessSync, constants, readdirSync } from \"fs\";\ntry {\n  accessSync(localP, constants.R_OK);\n  readdirSync(localP);\n} catch (e) {\n  console.error(`Unreadable sync dir ${localP}: ${e}`);\n  process.exit(1);\n}","typeGuard":"function isReadableDir(p: string): boolean {\n  try { return require(\"fs\").statSync(p).isDirectory(); } catch { return false; }\n}","tryCatchPattern":"try {\n  await wmill.sync.pull(...);\n} catch (e) {\n  if (String(e).includes(\"Error reading dir\")) {\n    console.error(\"Fix filesystem permissions/symlinks, then retry:\", e);\n  } else throw e;\n}","preventionTips":["Run the CLI as a user with read access to the entire sync root.","Prune broken symlinks (find . -xtype l) before syncing.","Avoid syncing directories other processes mutate concurrently.","Exclude build artifacts (node_modules, dist) from the sync root."],"tags":["cli","filesystem","permissions","sync"],"backgroundTag":"filesystem-read-error","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}