skylot/jadx · error · JadxRuntimeException

Failed to create temp directory with suffix: ${prefix}

Error message

Failed to create temp directory with suffix: ${prefix}

What it means

Thrown by createTempDir(String prefix) when Files.createTempDirectory(tempRootDir, prefix) fails. This creates a temp directory under jadx's managed tempRootDir. Failure means the tempRootDir itself does not exist, is not writable, the prefix is invalid (contains path separators or illegal characters), or disk/inode space is exhausted. The method is deprecated in favor of IJadxFilesGetter.

Source

Thrown at jadx-core/src/main/java/jadx/core/utils/files/FileUtils.java:252

		try {
			deleteDir(clearDir, true);
		} catch (Exception e) {
			throw new JadxRuntimeException("Failed to clear directory " + clearDir, e);
		}
	}

	/**
	 * Deprecated.
	 * Migrate to {@link IJadxFilesGetter} from jadx args to get temp dir
	 */
	@Deprecated
	public static Path createTempDir(String prefix) {
		try {
			Path dir = Files.createTempDirectory(tempRootDir, prefix);
			dir.toFile().deleteOnExit();
			return dir;
		} catch (Exception e) {
			throw new JadxRuntimeException("Failed to create temp directory with suffix: " + prefix, e);
		}
	}

	/**
	 * Deprecated.
	 * Migrate to {@link IJadxFilesGetter} from jadx args to get temp dir
	 */
	@Deprecated
	public static Path createTempFile(String suffix) {
		try {
			Path path = Files.createTempFile(tempRootDir, JADX_TMP_PREFIX, suffix);
			path.toFile().deleteOnExit();
			return path;
		} catch (Exception e) {
			throw new JadxRuntimeException("Failed to create temp file with suffix: " + suffix, e);
		}
	}

View on GitHub (pinned to e738a26571)

Solutions

  1. Migrate to IJadxFilesGetter from jadx args as the deprecation notice advises.
  2. Ensure tempRootDir still exists before calling: FileUtils.isTempRootDirValid() or check Files.isDirectory(tempRootDir).
  3. Avoid path separators and OS-illegal characters in the prefix string.
  4. Verify free disk space and inodes on the temp filesystem.

Example fix

// before (deprecated)
Path dir = FileUtils.createTempDir("extract-");

// after — use IJadxFilesGetter from args
Path dir = args.getFilesGetter().createTempDir("extract-");
Defensive patterns

Strategy: validation

Validate before calling

public static boolean canCreateTempUnderRoot() {
    try {
        return Files.isDirectory(Path.of(System.getProperty("java.io.tmpdir")));
    } catch (Exception e) {
        return false;
    }
}

Try / catch

try {
    Path dir = FileUtils.createTempDir(prefix);
} catch (JadxRuntimeException e) {
    LOG.error("cannot create temp dir with prefix '{}': {}", prefix, e.getCause().getMessage());
    throw e;
}

Prevention

When it happens

Trigger: Calling createTempDir when tempRootDir was deleted or cleared between initialization and this call. The prefix string contains path separators or characters illegal for filenames. The temp filesystem is full or out of inodes. tempRootDir permissions changed after JVM startup.

Common situations: Calling this after clearTempRootDir() has removed the root. In a long-running jadx process where the OS cleaned up /tmp. Deprecated API usage in code that hasn't migrated to IJadxFilesGetter. Disk full in CI.

Related errors


AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14). Data as JSON: /api/errors/ae7b26135c6d96c5. Report an issue: GitHub.