Lambda: Unzipped size must be smaller than 262144000 bytes
The function code plus layers exceed Lambda’s 250 MB unzipped limit for zip deployments.
Seen on:
AWS
Meaning
Heavy dependencies (pandas, numpy, torch, Chromium, the AWS SDK bundled twice) blow past the limit. Container image functions allow up to 10 GB.
Common causes
- Large dependencies (ML/data libraries, headless browsers)
- Dev dependencies/tests/docs bundled
- Same library in both function and layer
⚡ Quick fix
- Deploy as a container image (10 GB)
- Strip dev dependencies and caches; bundle/tree-shake (esbuild)
- Move shared libs to a layer without duplicates
Detailed fix by platform
AWS CLI
- bash
du -sh package/* | sort -h | tail # container image function aws lambda create-function --function-name fn --package-type Image --code ImageUri=123456789012.dkr.ecr.eu-west-1.amazonaws.com/fn:1 --role arn:aws:iam::123456789012:role/fn-role
How to diagnose
- Size — du of unzipped package + layers
- Contents — Biggest folders
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in AWS
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026