Flutter FileSystemException No Space Left On Device
When Flutter exits with FileSystemException: writeFrom failed, OS Error: No space left on device, errno = 28, the failing file write is usually a symptom. Measure temp folders, .dart_tool, pub cache, Gradle, Android emulator state, Xcode, and simulator storage before deleting anything broad.
Find the bucket that filled before clearing caches.
Run the command for your platform, keep the output, then clean the smallest proven bucket first. This avoids wiping emulator data, iOS simulator state, or project artifacts that were not the cause.
df -h; du -sh .dart_tool build ~/.pub-cache ~/.gradle/caches ~/Library/Developer/Xcode/DerivedData ~/Library/Developer/CoreSimulator /tmp 2>/dev/null || true
Use this before suggesting a broad temp wipe.
This gives maintainers evidence without asking users to delete source files, emulator data, or all temp contents.
Before clearing broad cache folders, capture the disk buckets around the failing Flutter command:
df -h
du -sh .dart_tool build ~/.pub-cache ~/.gradle/caches /tmp 2>/dev/null || true
du -sh ~/Library/Developer/Xcode/DerivedData ~/Library/Developer/CoreSimulator 2>/dev/null || true
If the failure is in CI, also print disk usage before and after:
- flutter pub get
- flutter test / flutter build
- Gradle assemble
- emulator or simulator startup
Then clean the proven bucket:
- .dart_tool/build for project-local generated state
- /tmp/flutter_tools.* for stale Flutter temp dirs
- Gradle cache only when Gradle owns the growth
- Xcode DerivedData/CoreSimulator only for iOS/macOS builds
Common Buckets
- Project-local generated state:
.dart_tool,build, and test artifacts can grow during repeated runs. - Flutter temp: stale
/tmp/flutter_tools.*directories can survive interrupted runs. - Pub and Gradle caches: usually rebuildable, but measure first so you do not slow every later build for no gain.
- Android emulator state: images, snapshots, and app data can be large and may be needed for reproduction.
- Xcode and simulators: iOS/macOS Flutter builds also touch DerivedData, CoreSimulator, DeviceSupport, and Archives.
Safer Cleanup Order
- Record
df -hand the biggest Flutter-adjacent folders before cleanup. - Close running Flutter, Gradle, emulator, simulator, and IDE processes that may still be writing.
- Delete project-local generated state only when you can rebuild it.
- Remove stale Flutter temp folders rather than every file in
/tmp. - Clean platform caches through their owning tools where possible.
- For CI, split the build around peak disk steps and print disk telemetry after each one.
Want the first safe cleanup order?
The $29 Flutter triage reviews one failing command, disk summary, or CI log and returns the first safe cleanup/split plan for Flutter, Gradle, Android emulator, Xcode, and simulator storage.