{"record":{"id":"e1c01ab935273a2f","repo":"stablyai/orca","slug":"remote-import-is-too-large","errorCode":null,"errorMessage":"Remote import is too large","messagePattern":"Remote import is too large","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/filesystem-mutations.ts","lineNumber":654,"sourceCode":"  // Why: `..name` is a valid child path; only `..` and `../...` escape.\n  if (\n    relativeToRoot !== '' &&\n    (relativeToRoot === '..' || relativeToRoot.startsWith(`..${sep}`) || isAbsolute(relativeToRoot))\n  ) {\n    throw new Error(`Path escaped upload root during staging: '${displayPath}'`)\n  }\n}\n\nfunction assertRemoteUploadBudget(\n  relativePath: string,\n  fileBytes: number,\n  totalBytes: number\n): void {\n  if (fileBytes > REMOTE_IMPORT_MAX_FILE_BYTES) {\n    throw new Error(`'${relativePath}' is too large for remote import`)\n  }\n  if (totalBytes > REMOTE_IMPORT_MAX_TOTAL_BYTES) {\n    throw new Error('Remote import is too large')\n  }\n}\n\nfunction normalizeRelativeUploadPath(path: string): string {\n  return path.replace(/[\\\\/]+/g, '/').replace(/^\\/+/, '')\n}\n\n/**\n * Pre-scan a directory tree for symlinks. Returns true if any symlink\n * is found anywhere in the subtree.\n */\nasync function preScanForSymlinks(dirPath: string): Promise<boolean> {\n  const entries = await readdir(dirPath, { withFileTypes: true })\n  for (const entry of entries) {\n    if (entry.isSymbolicLink()) {\n      return true\n    }\n    if (entry.isDirectory()) {","sourceCodeStart":636,"sourceCodeEnd":672,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/filesystem-mutations.ts#L636-L672","documentation":"Thrown by assertRemoteUploadBudget when the cumulative byte total across all staged files exceeds REMOTE_IMPORT_MAX_TOTAL_BYTES (100 MB). This cap prevents the combined base64 payload of a directory import from overwhelming the IPC channel or remote relay.","triggerScenarios":"Importing a directory tree whose total file sizes sum to more than 100 MB. The running total (totalBytesBefore + current file size) is checked per file, so the error fires on the file that pushes the total over the limit.","commonSituations":"Bulk-importing a large project directory with many source files, assets, or node_modules. Importing a directory with large media or data files that individually pass the 25 MB file cap but collectively exceed 100 MB.","solutions":["Reduce the import scope: exclude large subdirectories (node_modules, build output, media).","Split the import into multiple smaller batches, each under 100 MB total.","Transfer large directories directly to the remote host via scp/rsync instead of through the IPC staging path."],"exampleFix":"// before: import entire project including 80MB of assets\n// after: exclude assets, import separately\n//   import /project/src and /project/docs (under 100MB)\n//   scp -r /project/assets remote:/worktree/assets","handlingStrategy":"validation","validationCode":"const { stat } = await import('node:fs/promises')\nconst REMOTE_IMPORT_MAX_TOTAL_BYTES = 100 * 1024 * 1024\n\nasync function assertTreeUnderTotalLimit(rootPath: string): Promise<void> {\n  const { readdir, lstat } = await import('node:fs/promises')\n  let total = 0\n  async function visit(dir: string): Promise<void> {\n    for (const e of await readdir(dir, { withFileTypes: true })) {\n      const p = join(dir, e.name)\n      if (e.isDirectory()) { await visit(p); continue }\n      total += (await lstat(p)).size\n      if (total > REMOTE_IMPORT_MAX_TOTAL_BYTES) {\n        throw new Error(`Total exceeds 100MB remote import limit at ${p}`)\n      }\n    }\n  }\n  await visit(rootPath)\n}","typeGuard":null,"tryCatchPattern":"try {\n  await stageRemoteImport(sourcePath)\n} catch (error) {\n  if (error instanceof Error && error.message === 'Remote import is too large') {\n    showUserError('Total import exceeds 100MB. Reduce scope or use scp for bulk transfer.')\n    return\n  }\n  throw error\n}","preventionTips":["Estimate directory size with `du -sh <source>` before staging.","Exclude large subdirectories (node_modules, build, assets) from the import.","Split large imports into batches under 100 MB total."],"tags":["size-limit","upload-staging","remote-import","ipc","filesystem"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}