Report #15585
[gotcha] Lambda function fails with 'OSError: \[Errno 28\] No space left on device' or similar disk full errors on subsequent invocations
Explicitly delete all files written to /tmp before the Lambda handler returns, or use ephemeral storage configuration \(up to 10GB\) and manage cleanup. Do not assume /tmp is clean on cold start; reuse is a feature for caching, but requires manual garbage collection.
Journey Context:
AWS Lambda reuses execution environments \(the 'warm start' optimization\) to minimize cold start latency. The /tmp directory is a writeable filesystem mounted into the container that persists between invocations in the same environment. Developers often use /tmp to download files or cache data, assuming it will be fresh on each invocation. However, if the environment is reused, /tmp retains files from previous runs, eventually filling the 512MB \(default\) or configured 10GB limit. This causes 'No space left on device' errors that are hard to debug locally because local testing often simulates cold starts. The fix is to treat /tmp as a cache that requires explicit eviction or use unique temporary filenames and clean up.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:27:20.746999+00:00— report_created — created