Large files — photos, videos, PDFs — should live in Caffeine file storage, not inside the app itself. File storage keeps the heavy content off your canister so the app stays within its memory limit. If those files were saved inside the app instead, memory can fill up and the live app starts failing.
What you will see
The app may show an error such as heap out of bounds, IC0502, or IC0522. Uploads, saves, exports, or a cleanup action you added can all fail with the same message.
This is not the same as running out of cycles. Cycle issues show as IC0508 or "Service temporarily unavailable" and usually recover on their own. A full memory limit does not. See Understanding Canister Cycles.
What to try
Pause cleanup prompts. Asking the AI to add a purge or "free memory" function usually hits the same error, because that cleanup also needs free memory to run. Those prompts still use credits.
Delete files one at a time in the app, if a single delete still works. Removing one file is sometimes small enough to succeed when a bulk cleanup is not.
If you are willing to start the live app's data over, you can clear memory by resetting or republishing — this deletes all live data, not only files. Clients, records, and uploads are all removed. After that, ask the AI to use Caffeine file storage for any future uploads so the limit does not fill up again. See Publishing and Sharing Your App for Reset app data and Take offline.
Start a new project if you prefer a clean break, and ask for file storage from the first prompt that involves uploads.
It is not possible to empty only the files and keep the rest of the live data.
How to avoid this
When you add uploads, say that files should use Caffeine file storage. For example:
- "Let users upload photos using Caffeine file storage"
- "Store PDFs and videos in file storage"
- "Add an image gallery with Caffeine file storage"
If the app is not full yet, you can ask: "Are uploaded files using Caffeine file storage? If not, switch them to file storage before any more uploads." Once memory is already full, that switch usually cannot run until the live data is cleared.
See What Is File Storage? and File Storage – Troubleshooting.
Frequently asked questions
What do IC0502 and "heap out of bounds" mean?
They mean this app has reached its memory limit. Other Caffeine apps are not affected. Cycle errors look different — they show as IC0508 or "Service temporarily unavailable" and typically recover after a short wait.
Can I keep my business data and only remove the files?
No. Clearing a full memory limit means clearing all live data, then publishing again. There is no way to remove only photos, videos, or PDFs and leave everything else in place.
Should I keep asking the AI to purge files?
No. Further purge prompts use credits and usually fail with the same memory error. Use one of the options above instead.
Does Reset app data fix this?
Reset app data deletes all live data and can free the memory limit, but it does not change how new files are stored. If uploads still go into the app instead of file storage, the limit will fill up again. After a reset, ask the AI to use Caffeine file storage for uploads.