skylot/jadx · error · JadxRuntimeException

Failed to reset code cache

Error message

Failed to reset code cache

What it means

DiskCodeCache.reset attempts to delete the old cache directory tree and recreate it fresh (src and meta subdirectories, version file). If any filesystem operation fails during this process, a JadxRuntimeException is thrown. The finally block always marks all classes as uncached.

Source

Thrown at jadx-gui/src/main/java/jadx/gui/cache/code/disk/DiskCodeCache.java:95

	}

	private void reset() {
		try {
			long start = System.currentTimeMillis();
			LOG.info("Resetting disk code cache, base dir: {}", baseDir.toAbsolutePath());
			FileUtils.deleteDirIfExists(baseDir);
			if (Files.exists(baseDir.getParent().resolve(codeVersionFile.getFileName()))) {
				// remove old version cache files
				FileUtils.deleteDirIfExists(baseDir.getParent());
			}
			FileUtils.makeDirs(srcDir);
			FileUtils.makeDirs(metaDir);
			FileUtils.writeFile(codeVersionFile, codeVersion);
			if (LOG.isDebugEnabled()) {
				LOG.info("Reset done in: {}ms", System.currentTimeMillis() - start);
			}
		} catch (Exception e) {
			throw new JadxRuntimeException("Failed to reset code cache", e);
		} finally {
			clsDataMap.values().forEach(d -> d.setCached(false));
		}
	}

	/**
	 * Async writes backed by in-memory store
	 */
	@Override
	public void add(String clsFullName, ICodeInfo codeInfo) {
		CacheData clsData = getClsData(clsFullName);
		clsData.setTmpCodeInfo(codeInfo);
		clsData.setCached(true);
		writePool.execute(() -> {
			try {
				int clsId = clsData.getClsId();
				ICodeInfo code = clsData.getTmpCodeInfo();
				if (code != null) {

View on GitHub (pinned to e738a26571)

Solutions

  1. Close all other jadx instances before resetting
  2. Check and fix permissions on the cache directory
  3. Move the cache to a local, non-synced directory
  4. Free disk space
  5. Manually delete the cache directory and retry

Example fix

// Configure a clean, local cache directory in jadx-gui settings,
// or manually delete the cache before starting jadx:
Path cache = Paths.get(System.getProperty("user.home"), ".jadx", "cache");
FileUtils.deleteDirectory(cache.toFile());
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify cache dir is writable and not locked before reset
if (!Files.isWritable(baseDir.getParent())) { throw new IllegalStateException("Cannot reset cache"); }

Try / catch

try {
    diskCodeCache.reset();
} catch (JadxRuntimeException e) {
    if (e.getMessage().contains("Failed to reset code cache")) {
        LOG.warn("Manual cache clear needed", e);
        FileUtils.deleteDirectory(baseDir.toFile()); // user-initiated
    }
}

Prevention

When it happens

Trigger: reset() deletes the base directory, optionally removes a parent if an old version file exists, recreates srcDir and metaDir, and writes the version file. Any exception (permission denied, file locked, disk full, directory in use) triggers the error. Called when the cache version changes or a manual reset is requested.

Common situations: Cache directory locked by another process (another jadx instance, antivirus scan). Permission denied on cache directory after OS update or user account change. Disk full. Network-mounted or sync-backed cache directory with I/O errors (Dropbox, OneDrive).

Related errors


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