{"record":{"id":"a690d821ca367f39","repo":"beemdevelopment/Aegis","slug":"unable-to-create-directories-s","errorCode":null,"errorMessage":"Unable to create directories: %s","messagePattern":"Unable to create directories: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/icons/IconPackManager.java","lineNumber":92,"sourceCode":"            try (ZipInputStream inStream = zipFile.getInputStream(packHeader)) {\n                defBytes = IOUtils.readAll(inStream);\n                pack = IconPack.fromBytes(defBytes);\n            }\n\n            // create a new directory to store the icon pack, based on the UUID and version\n            File packDir = getIconPackDir(pack);\n            if (!packDir.getCanonicalPath().startsWith(_iconsBaseDir.getCanonicalPath() + File.separator)) {\n                throw new IOException(\"Attempted to write outside of the parent directory\");\n            }\n            if (packDir.exists()) {\n                throw new IconPackExistsException(pack);\n            }\n            IconPack existingPack = getIconPackByUUID(pack.getUUID());\n            if (existingPack != null) {\n                throw new IconPackExistsException(existingPack);\n            }\n            if (!packDir.exists() && !packDir.mkdirs()) {\n                throw new IOException(String.format(\"Unable to create directories: %s\", packDir.toString()));\n            }\n\n            // extract each of the defined icons to the icon pack directory\n            for (IconPack.Icon icon : pack.getIcons()) {\n                File destFile = new File(packDir, icon.getRelativeFilename());\n                if (!destFile.getCanonicalPath().startsWith(packDir.getCanonicalPath() + File.separator)) {\n                    throw new IOException(\"Attempted to write outside of the icon pack directory\");\n                }\n                FileHeader iconHeader = zipFile.getFileHeader(icon.getRelativeFilename());\n                if (iconHeader == null) {\n                    throw new IOException(String.format(\"Unable to find %s relative to the root of the ZIP file\", icon.getRelativeFilename()));\n                }\n\n                // create new directories for this file if needed\n                File parent = destFile.getParentFile();\n                if (parent != null && !parent.exists() && !parent.mkdirs()) {\n                    throw new IOException(String.format(\"Unable to create directories: %s\", packDir.toString()));\n                }","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/icons/IconPackManager.java#L74-L110","documentation":"importPack creates the per-pack directory (named from the pack's UUID and version) with File.mkdirs(). If the directory doesn't exist and mkdirs() returns false — typically a filesystem/permission problem or a name collision with an existing regular file — this IOException is thrown with the target directory path.","triggerScenarios":"packDir.mkdirs() returning false during importPack: the app's external storage is unavailable/read-only, a file (not directory) already exists at the target path, or the filesystem is full.","commonSituations":"SD card mounted as read-only or removed mid-import; leftover file from a previously failed import occupying the UUID-based path; storage full on device.","solutions":["Check device storage is available and not full; retry the import","Clear Aegis's cache/data for the icons directory or delete the conflicting file at the target path","Remount or reinsert external storage if the SD card is read-only or missing","Retry the import after rebooting the device"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"File packDir = new File(iconsBaseDir, uuid);\nif (packDir.exists() && !packDir.isDirectory()) {\n    throw new IconPackException(\"Conflicting file at \" + packDir);\n}\nif (!packDir.getCanonicalFile().toPath().startsWith(iconsBaseDir.getCanonicalFile().toPath())) {\n    throw new IconPackException(\"Unsafe path\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    iconPackManager.importPack(file);\n} catch (IconPackException e) {\n    UiHelper.showDialog(context, R.string.import_error_storage);\n}","preventionTips":["Check free storage space before importing","Clean up partially-imported pack directories after failures","Verify external storage is mounted writable","Delete conflicting non-directory files at target paths first"],"tags":["filesystem","mkdir","android","storage"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"d6f4e5925a97e4e91593f1542085eae03432a759","analyzedAt":"2026-09-08T00:46:31.111Z","contentChangedAt":"2026-09-08T00:46:31.111Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}