{"record":{"id":"ca0a44d894e1826d","repo":"Budibase/budibase","slug":"invalid-zip-too-many-files-max-max-pwa-zip-fi","errorCode":null,"errorMessage":"Invalid zip - too many files (max ${MAX_PWA_ZIP_FILE_COUNT})","messagePattern":"Invalid zip - too many files \\(max (.+?)\\)","errorType":"http","errorClass":"BadRequestError","httpStatus":400,"severity":"error","filePath":"packages/server/src/api/controllers/static/index.ts","lineNumber":125,"sourceCode":"    }\n\n    const depth =\n      entry.fileName.split(\"/\").filter(Boolean).length -\n      (entry.fileName.endsWith(\"/\") ? 0 : 1)\n    if (depth > MAX_PWA_ZIP_DEPTH) {\n      throw new BadRequestError(\n        `Invalid zip - directory depth exceeds ${MAX_PWA_ZIP_DEPTH}`\n      )\n    }\n\n    // Directory entries carry no content, only enforce the depth limit on them.\n    if (entry.fileName.endsWith(\"/\")) {\n      return\n    }\n\n    fileCount++\n    if (fileCount > MAX_PWA_ZIP_FILE_COUNT) {\n      throw new BadRequestError(\n        `Invalid zip - too many files (max ${MAX_PWA_ZIP_FILE_COUNT})`\n      )\n    }\n\n    if (entry.uncompressedSize > MAX_PWA_ZIP_ENTRY_SIZE) {\n      throw new BadRequestError(\n        `Invalid zip - file \"${entry.fileName}\" exceeds the maximum size`\n      )\n    }\n\n    totalUncompressedSize += entry.uncompressedSize\n    if (totalUncompressedSize > MAX_PWA_ZIP_TOTAL_SIZE) {\n      throw new BadRequestError(\n        \"Invalid zip - uncompressed contents exceed the maximum size\"\n      )\n    }\n  }\n}","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/api/controllers/static/index.ts#L107-L143","documentation":"Thrown by validatePWAZipEntries when a PWA zip contains more than MAX_PWA_ZIP_FILE_COUNT (100) non-directory entries. It caps the number of files extracted into object storage to bound resource usage. Directory entries and __MACOSX/ artifacts are skipped and not counted.","triggerScenarios":"Uploading a PWA zip whose archive has more than 100 files (excluding directories), via the PWA upload endpoint handled by processPWAZip.","commonSituations":"Uploading an unminified build with many source maps and per-chunk assets, or a zip containing node_modules or a full export of an icon set.","solutions":["Reduce the zip to 100 files or fewer by removing unneeded assets","Bundle assets (sprites, combined JS/CSS) before packaging","Split into multiple zips if the platform allows"],"exampleFix":"// before\nmy-pwa.zip: 250 files (all icons individually)\n// after\nmy-pwa.zip: 80 files (icons bundled into sprites/manifest)","handlingStrategy":"validation","validationCode":"function isPwaZipFileCountSafe(fileNames, max = 100) {\n  return fileNames.filter(n => !n.endsWith('/') && !n.startsWith('__MACOSX/')).length <= max\n}","typeGuard":"const isZipEntry = (e: unknown): e is { fileName: string; uncompressedSize: number; externalFileAttributes: number } =>\n  typeof e === 'object' && e !== null && typeof (e as any).fileName === 'string'","tryCatchPattern":"try {\n  await uploadPwaZip(zip)\n} catch (err) {\n  if (err instanceof BadRequestError && err.message.includes('too many files')) {\n    // bundle or prune assets and retry once\n  } else throw err\n}","preventionTips":["Count non-directory entries before upload; keep under 100","Exclude node_modules, source maps, and OS junk (__MACOSX, .DS_Store) from archives","Bundle icon sets into sprites or a single icons.json"],"tags":["validation","pwa","upload","zip"],"backgroundTag":"zip-validation-failed","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}