skylot/jadx · critical · RuntimeException
Failed to create temp root directory
Error message
Failed to create temp root directory
What it means
Thrown by JadxTempFiles (static init) as a RuntimeException wrapping any exception during temp root directory creation. It honors JADX_TMP_DIR (creating a temp instance dir under it) or falls back to the system temp dir; any failure is wrapped here.
Source
Thrown at jadx-commons/jadx-app-commons/src/main/java/jadx/commons/app/JadxTempFiles.java:30
public static Path getTempRootDir() {
return TEMP_ROOT_DIR;
}
private static Path createTempRootDir() {
try {
String jadxTmpDir = System.getenv("JADX_TMP_DIR");
Path dir;
if (jadxTmpDir != null) {
Path customTmpRootDir = Paths.get(jadxTmpDir);
Files.createDirectories(customTmpRootDir);
dir = Files.createTempDirectory(customTmpRootDir, JADX_TMP_INSTANCE_PREFIX);
} else {
dir = Files.createTempDirectory(JADX_TMP_INSTANCE_PREFIX);
}
dir.toFile().deleteOnExit();
return dir;
} catch (Exception e) {
throw new RuntimeException("Failed to create temp root directory", e);
}
}
}
View on GitHub (pinned to e738a26571)
Solutions
- Point JADX_TMP_DIR to a writable absolute directory.
- Ensure java.io.tmpdir (system temp) is writable.
- Free space on the temp filesystem.
- Check container mount options for /tmp (remove ro/noexec if present).
Example fix
// before (read-only /tmp in container) jadx input.apk // after JADX_TMP_DIR=/var/tmp/jadx jadx input.apk
Defensive patterns
Strategy: try-catch
Validate before calling
String t = System.getenv("JADX_TMP_DIR");
if (t != null) {
Path p = Paths.get(t);
Files.createDirectories(p);
if (!Files.isWritable(p)) throw new IllegalStateException("JADX_TMP_DIR not writable: " + t);
} else {
Path sysTmp = Paths.get(System.getProperty("java.io.tmpdir"));
if (!Files.isWritable(sysTmp)) throw new IllegalStateException("System temp not writable: " + sysTmp);
} Type guard
public static boolean tmpWritable() {
try {
Path t = System.getenv("JADX_TMP_DIR") != null ? Paths.get(System.getenv("JADX_TMP_DIR")) : Paths.get(System.getProperty("java.io.tmpdir"));
Files.createDirectories(t);
return Files.isWritable(t);
} catch (IOException e) { return false; }
} Try / catch
// Fires during static init of JadxTempFiles
try {
Class.forName("jadx.commons.app.JadxTempFiles");
} catch (ExceptionInInitializerError e) {
Throwable c = e.getCause();
if (c instanceof RuntimeException && c.getMessage().equals("Failed to create temp root directory")) {
System.err.println("Set JADX_TMP_DIR to a writable dir. Cause: " + c.getCause());
System.exit(1);
}
throw e;
} Prevention
- In containers, mount /tmp writable or set JADX_TMP_DIR to a writable volume.
- Avoid noexec/ro mounts on the temp directory.
- Monitor free space on the temp filesystem.
When it happens
Trigger: JADX_TMP_DIR set to a path where createDirectories or createTempDirectory fails; the system java.io.tmpdir is not writable; permission denied; disk full during init.
Common situations: Running jadx in a container/CI where /tmp is read-only or mounted with noexec/nodev; JADX_TMP_DIR pointing to a non-existent parent that cannot be created; temp filesystem full.
Related errors
- Failed to init common directories
- Failed to save JSON file: {}
- Failed to save JSON file: {}
- {}
- Failed to open zip: {}
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/d3d006e475a915d5.
Report an issue: GitHub.