{"record":{"id":"04b8b65bde8196bf","repo":"nexu-io/open-design","slug":"zip-file-too-large-relpath","errorCode":null,"errorMessage":"zip file too large: ${relPath}","messagePattern":"zip file too large: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"apps/daemon/src/design/claude-design-import.ts","lineNumber":36,"sourceCode":"  uncompressedSize: number;\n  localOffset: number;\n  isDirectory: boolean;\n};\n\ntype ImportedFile = { path: string; body: Buffer };\n\nexport async function importClaudeDesignZip(zipPath: string, projectDir: string) {\n  const zip = await readFile(zipPath);\n  const entries = readCentralDirectory(zip);\n  const files: ImportedFile[] = [];\n  let totalBytes = 0;\n\n  for (const entry of entries) {\n    if (entry.isDirectory) continue;\n    if (files.length >= MAX_FILES) throw new Error('zip contains too many files');\n    const relPath = sanitizeZipPath(entry.name);\n    if (entry.uncompressedSize > MAX_FILE_BYTES) {\n      throw new Error(`zip file too large: ${relPath}`);\n    }\n\n    // Decode first; the central directory's uncompressedSize is unreliable for\n    // streaming/data-descriptor zips (it can read 0 even when the payload\n    // carries real data). The inflate cap and the post-decode size checks below\n    // are authoritative.\n    const body = readEntryBody(zip, entry);\n    if (body.length > MAX_FILE_BYTES) {\n      throw new Error(`zip file too large: ${relPath}`);\n    }\n    if (entry.uncompressedSize > 0 && body.length !== entry.uncompressedSize) {\n      throw new Error(`zip entry size mismatch: ${relPath}`);\n    }\n    totalBytes += body.length;\n    if (totalBytes > MAX_TOTAL_BYTES) throw new Error('zip is too large');\n\n    files.push({ path: relPath, body: normalizeImportedClaudeDesignFile(relPath, body) });\n  }","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/design/claude-design-import.ts#L18-L54","documentation":"Thrown by `importClaudeDesignZip` when a central-directory entry's declared `uncompressedSize` exceeds `MAX_FILE_BYTES` (25 MiB). This is the pre-decode size guard, evaluated before the entry body is inflated.","triggerScenarios":"A zip entry whose central-directory header advertises an uncompressed size greater than 25 MiB (e.g. a large embedded media file, data file, or bundled script inside the Claude Design archive).","commonSituations":"An export that accidentally includes a large binary (video, image, database). A bundled JS file larger than 25 MiB. Note: for streaming/data-descriptor zips the declared size can read 0, in which case the post-decode check (error 234) is the one that trips.","solutions":["Remove or shrink the oversized entry so its declared uncompressed size is at or below 25 MiB.","Externalize large media so it is not bundled in the zip.","Re-export the design choosing only the HTML and minimal assets."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const MAX_FILE_BYTES = 25 * 1024 * 1024;\n\nfunction declaredSizesWithinCap(entries: { isDirectory: boolean; uncompressedSize: number }[]): boolean {\n  return entries.filter((e) => !e.isDirectory).every((e) => e.uncompressedSize <= MAX_FILE_BYTES);\n}\n\nif (!declaredSizesWithinCap(entries)) {\n  throw new Error('one or more entries declare an uncompressed size over 25 MiB');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await importClaudeDesignZip(zipPath, projectDir);\n} catch (err) {\n  if (err instanceof Error && /^zip file too large:/.test(err.message)) {\n    // remove or shrink the named oversized entry\n  }\n  throw err;\n}","preventionTips":["Keep each archive entry under 25 MiB uncompressed.","Externalize large media instead of bundling it in the zip.","Pre-scan declared entry sizes before importing."],"tags":["zip","claude-design","size-limit","import","zip-bomb"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}