Budibase/budibase · error · BadRequestError
Invalid zip - file "${entry.fileName}" exceeds the maximum s
Error message
Invalid zip - file "${entry.fileName}" exceeds the maximum size What it means
Thrown by validatePWAZipEntries when a single zip entry's uncompressedSize exceeds MAX_PWA_ZIP_ENTRY_SIZE (10MB). This prevents individual entries from consuming excessive disk and memory when the PWA is extracted and served.
Source
Thrown at packages/server/src/api/controllers/static/index.ts:131
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"
)
}
}
}
const listFilesRecursively = async (directory: string): Promise<string[]> => {
const entries = await fsp.readdir(directory, { withFileTypes: true })
const files = await Promise.all(
entries.map(async entry => {
const entryPath = join(directory, entry.name)View on GitHub (pinned to a81a902e9a)
Solutions
- Compress or resize the offending file below 10MB uncompressed
- Minify JS/CSS and strip source maps from the archive
- Remove large assets not required by the manifest
Example fix
// before bundle.js (unminified, 14MB uncompressed) // after bundle.min.js (2MB uncompressed)
Defensive patterns
Strategy: validation
Validate before calling
function isPwaZipEntrySizeSafe(entries, maxPerFile = 10 * 1024 * 1024) {
return entries.every(e => e.uncompressedSize <= maxPerFile)
} Type guard
const hasUncompressedSize = (e: unknown): e is { uncompressedSize: number } =>
typeof e === 'object' && e !== null && typeof (e as any).uncompressedSize === 'number' Try / catch
try {
await uploadPwaZip(zip)
} catch (err) {
if (err instanceof BadRequestError && err.message.includes('exceeds the maximum size')) {
// minify/compress the named file and retry
} else throw err
} Prevention
- Check each file's uncompressed size before zipping; keep under 10MB
- Minify JS/CSS and strip source maps from PWA archives
- Compress large images and subset fonts
When it happens
Trigger: Uploading a PWA zip where any one file, e.g. a large image or bundle, decompresses to more than 10MB.
Common situations: Including an oversized hero image, a multi-megabyte font set, or an unminified JS bundle inside the PWA archive.
Related errors
- Invalid zip - uncompressed contents exceed the maximum size
- Invalid zip - directory depth exceeds ${MAX_PWA_ZIP_DEPTH}
- Invalid zip - too many files (max ${MAX_PWA_ZIP_FILE_COUNT})
- 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/24b885f50f9c9916.
Report an issue: GitHub.