skylot/jadx · error · JadxRuntimeException

Failed to create temp file with suffix

Error message

Failed to create temp file with suffix: ${suffix}

What it means

Thrown by createTempFile(String suffix) when Files.createTempFile(tempRootDir, JADX_TMP_PREFIX, suffix) fails. The temp file is created under jadx's managed tempRootDir with a fixed 'jadx-tmp-' prefix. Failure causes: tempRootDir missing/unwritable, suffix contains illegal characters or path separators, disk full, or inode exhaustion. The method is deprecated.

Solutions

  1. Migrate to IJadxFilesGetter from jadx args as the deprecation notice advises.
  2. Sanitize the suffix: strip path separators and OS-illegal characters.
  3. Ensure tempRootDir exists and is writable before calling.
  4. Monitor free disk space during long decompilation runs.

Example fix

// before (deprecated)
Path tmp = FileUtils.createTempFile(".dex");

// after — use IJadxFilesGetter
Path tmp = args.getFilesGetter().createTempFile(".dex");
Defensive patterns

Strategy: validation

Validate before calling

public static boolean isValidTempSuffix(String suffix) {
    return suffix != null && !suffix.contains("/") && !suffix.contains("\\")
        && suffix.matches("[a-zA-Z0-9._-]*");
}

Try / catch

try {
    Path tmp = FileUtils.createTempFile(suffix);
} catch (JadxRuntimeException e) {
    LOG.error("cannot create temp file with suffix '{}': {}", suffix, e.getCause().getMessage());
    throw e;
}

Prevention

When it happens

Trigger: Calling createTempFile when tempRootDir was deleted. The suffix contains a path separator or illegal filename character. The temp filesystem is out of space or inodes. Permission on tempRootDir changed after startup.

Common situations: Calling after clearTempRootDir removed the root. Deprecated API usage not yet migrated. Large decompilation jobs exhausting temp disk. Invalid suffix string from dynamic configuration.

Related errors


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

Appendix: source

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

			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);
		}
	}

	/**
	 * Deprecated.
	 * Prefer {@link IJadxFilesGetter} from jadx args to get temp dir
	 */
	@Deprecated
	public static Path createTempFileNoDelete(String suffix) {
		try {
			return Files.createTempFile(Files.createTempDirectory("jadx-persist"), "jadx-", suffix);
		} catch (Exception e) {
			throw new JadxRuntimeException("Failed to create temp file with suffix: " + suffix, e);
		}
	}

	/**
	 * Deprecated.

View on GitHub (pinned to e738a26571)