Budibase/budibase · error · BadRequestError
Invalid zip - too many files (max ${MAX_PWA_ZIP_FILE_COUNT})
Error message
Invalid zip - too many files (max ${MAX_PWA_ZIP_FILE_COUNT}) What it means
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.
Source
Thrown at packages/server/src/api/controllers/static/index.ts:125
}
const depth =
entry.fileName.split("/").filter(Boolean).length -
(entry.fileName.endsWith("/") ? 0 : 1)
if (depth > MAX_PWA_ZIP_DEPTH) {
throw new BadRequestError(
`Invalid zip - directory depth exceeds ${MAX_PWA_ZIP_DEPTH}`
)
}
// Directory entries carry no content, only enforce the depth limit on them.
if (entry.fileName.endsWith("/")) {
return
}
fileCount++
if (fileCount > MAX_PWA_ZIP_FILE_COUNT) {
throw new BadRequestError(
`Invalid zip - too many files (max ${MAX_PWA_ZIP_FILE_COUNT})`
)
}
if (entry.uncompressedSize > MAX_PWA_ZIP_ENTRY_SIZE) {
throw new BadRequestError(
`Invalid zip - file "${entry.fileName}" exceeds the maximum size`
)
}
totalUncompressedSize += entry.uncompressedSize
if (totalUncompressedSize > MAX_PWA_ZIP_TOTAL_SIZE) {
throw new BadRequestError(
"Invalid zip - uncompressed contents exceed the maximum size"
)
}
}
}View on GitHub (pinned to a81a902e9a)
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
Example fix
// before my-pwa.zip: 250 files (all icons individually) // after my-pwa.zip: 80 files (icons bundled into sprites/manifest)
Defensive patterns
Strategy: validation
Validate before calling
function isPwaZipFileCountSafe(fileNames, max = 100) {
return fileNames.filter(n => !n.endsWith('/') && !n.startsWith('__MACOSX/')).length <= max
} Type guard
const isZipEntry = (e: unknown): e is { fileName: string; uncompressedSize: number; externalFileAttributes: number } =>
typeof e === 'object' && e !== null && typeof (e as any).fileName === 'string' Try / catch
try {
await uploadPwaZip(zip)
} catch (err) {
if (err instanceof BadRequestError && err.message.includes('too many files')) {
// bundle or prune assets and retry once
} else throw err
} Prevention
- 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
When it happens
Trigger: Uploading a PWA zip whose archive has more than 100 files (excluding directories), via the PWA upload endpoint handled by processPWAZip.
Common situations: 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.
Related errors
- Invalid zip - directory depth exceeds ${MAX_PWA_ZIP_DEPTH}
- Invalid zip - file "${entry.fileName}" exceeds the maximum s
- Invalid zip - uncompressed contents exceed the maximum size
- Stream to upload is invalid/undefined
- Plugin missing .js file.
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/ca0a44d894e1826d.
Report an issue: GitHub.