beemdevelopment/Aegis · error · IOException
Unable to delete directory
Error message
Unable to delete directory: %s
What it means
IconPackManager.deleteDir recursively deletes an icon pack directory and, after removing all children, calls dir.delete(). If that final delete fails — files re-created concurrently, open file handles, or read-only filesystem — it throws an IOException naming the directory. It is invoked by removeIconPack and recursively by itself for subdirectories.
Solutions
- Retry the icon pack removal after closing other Aegis screens/background work
- Reboot the device to release file handles, then remove the pack again
- Check the storage is writable; remount external storage if read-only
- Manually clear Aegis's data/cache if the directory remains stuck
Defensive patterns
Strategy: retry
Validate before calling
File dir = getIconPackDir(pack);
if (!dir.exists()) return; // nothing to delete
if (!dir.canWrite()) throw new IOException("Storage not writable: " + dir); Try / catch
try {
iconPackManager.removeIconPack(pack);
} catch (IconPackException e) {
Log.w(TAG, "Delete failed, will retry after releasing handles", e);
// schedule retry or ask user to reboot
} Prevention
- Close streams reading icons before removing a pack
- Retrying deletions once after a short delay handles transient locks
- Verify storage is mounted writable before removal
- Reboot if a directory is persistently undeletable (stale handles)
When it happens
Trigger: dir.delete() returning false during removeIconPack: the directory is not empty because a file appeared during traversal, a file handle is still open, or the storage is read-only/unmounted.
Common situations: Removing an icon pack while its icons are still referenced/open by another component; external storage mounted read-only or pulled mid-delete; filesystem left inconsistent after a crash.
Related errors
- Unable to create directory
- Unable to create directories
- Unable to create directory
- Unable to decode stream to bitmap
- Unable to find pack.json in the root of the ZIP file
AI-assisted analysis of beemdevelopment/Aegis@d6f4e5925a (2026-09-08).
Data as JSON: /api/errors/d4ea7cec3cc7f415.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/com/beemdevelopment/aegis/icons/IconPackManager.java:223
if (latestVersion == -1) {
return null;
}
return new File(packDir, Integer.toString(latestVersion));
}
private static void deleteDir(File dir) throws IOException {
if (dir.isDirectory()) {
File[] children = dir.listFiles();
if (children != null) {
for (File child : children) {
deleteDir(child);
}
}
}
if (!dir.delete()) {
throw new IOException(String.format("Unable to delete directory: %s", dir));
}
}
}
View on GitHub (pinned to d6f4e5925a)