{"record":{"id":"fcf7879c8b4a1e86","repo":"skylot/jadx","slug":"failed-to-create-temp-directory","errorCode":null,"errorMessage":"Failed to create temp directory","messagePattern":"Failed to create temp directory","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"jadx-core/src/main/java/jadx/core/plugins/files/TempFilesGetter.java","lineNumber":20,"sourceCode":"\nimport java.nio.file.Files;\nimport java.nio.file.Path;\n\nimport jadx.core.utils.files.FileUtils;\n\npublic class TempFilesGetter implements IJadxFilesGetter {\n\n\tpublic static final TempFilesGetter INSTANCE = new TempFilesGetter();\n\n\tprivate static final class TempRootHolder {\n\t\tpublic static final Path TEMP_ROOT_DIR;\n\n\t\tstatic {\n\t\t\ttry {\n\t\t\t\tTEMP_ROOT_DIR = Files.createTempDirectory(\"jadx-temp-\");\n\t\t\t\tTEMP_ROOT_DIR.toFile().deleteOnExit();\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException(\"Failed to create temp directory\", e);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate TempFilesGetter() {\n\t}\n\n\t@Override\n\tpublic Path getConfigDir() {\n\t\treturn makeSubDir(\"config\");\n\t}\n\n\t@Override\n\tpublic Path getCacheDir() {\n\t\treturn makeSubDir(\"cache\");\n\t}\n\n\t@Override","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/plugins/files/TempFilesGetter.java#L2-L38","documentation":"Thrown from the static initialiser of TempFilesGetter.TempRootHolder when Files.createTempDirectory(\"jadx-temp-\") fails (IOException). Because it is thrown from a class-init block, it surfaces to the caller as ExceptionInInitializerError (a linkage error) the first time any TempFilesGetter path is touched. It means jadx could not allocate its working directory under java.io.tmpdir.","triggerScenarios":"Starting jadx (CLI, GUI, or as a library) in an environment where the system temp dir is not writable, does not exist, is full, or where the JVM lacks permission to create directories. The failure happens once, at first use of any jadx file/dir API.","commonSituations":"Read-only filesystems, containers with an unmounted /tmp, low disk on the temp partition, SELinux/AppArmor denying directory creation, or a -Djava.io.tmpdir pointing at a non-existent or read-only path.","solutions":["Point the JVM at a writable temp dir: -Djava.io.tmpdir=/path/to/writable/dir.","Free space on, and check permissions of, the current java.io.tmpdir.","For containers, mount a writable /tmp (e.g. docker run with a tmpfs or a writable volume).","Verify the user running jadx has create/write permission on the temp dir."],"exampleFix":"# before\njava -jar jadx-cli.jar app.apk\n# after - use a writable tmp dir\nmkdir -p /var/tmp/jadx && java -Djava.io.tmpdir=/var/tmp/jadx -jar jadx-cli.jar app.apk","handlingStrategy":"validation","validationCode":"// ensure a writable temp dir before touching jadx\nPath tmp = Paths.get(System.getProperty(\"java.io.tmpdir\"));\nif (!Files.isWritable(tmp)) {\n    Path alt = Paths.get(System.getProperty(\"user.home\"), \".jadx-tmp\");\n    Files.createDirectories(alt);\n    System.setProperty(\"java.io.tmpdir\", alt.toString());\n}","typeGuard":null,"tryCatchPattern":"// ExceptionInInitializerError from a static block cannot be caught at the call site\n// in the usual way - pre-validate java.io.tmpdir instead, as shown in validationCode.","preventionTips":["Always run jadx with -Djava.io.tmpdir pointing at a writable dir in containers/CI.","Ensure the running user has create+write permission on the temp dir.","Free disk on the temp partition before launching jadx."],"tags":["environment","temp-dir","filesystem","permissions","startup"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}