skylot/jadx · error · JadxRuntimeException

Failed to enumerate cached classes

Error message

Failed to enumerate cached classes

What it means

DiskCodeCache scans the metadata directory via Files.walk to enumerate which class IDs have cached .jadxmd files, building a BitSet of cached classes. If the walk or file parsing fails (missing dir, I/O error, non-hex filename), a JadxRuntimeException is thrown.

Source

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

			throw new JadxRuntimeException("Unknown class name: " + clsFullName);
		}
		return clsData;
	}

	private void loadCachedSet() {
		long start = System.currentTimeMillis();
		BitSet cachedSet = new BitSet(clsDataMap.size());
		try (Stream<Path> stream = Files.walk(metaDir)) {
			stream.forEach(file -> {
				String fileName = file.getFileName().toString();
				if (fileName.endsWith(".jadxmd")) {
					String idStr = StringUtils.removeSuffix(fileName, ".jadxmd");
					int clsId = Integer.parseInt(idStr, 16);
					cachedSet.set(clsId);
				}
			});
		} catch (Exception e) {
			throw new JadxRuntimeException("Failed to enumerate cached classes", e);
		}
		int count = 0;
		for (CacheData data : clsDataMap.values()) {
			int clsId = data.getClsId();
			if (cachedSet.get(clsId)) {
				data.setCached(true);
				count++;
			}
		}
		LOG.info("Found {} classes in disk cache, time: {}ms, dir: {}",
				count, System.currentTimeMillis() - start, metaDir.getParent());
	}

	private Path getJavaFile(int clsId) {
		return srcDir.resolve(getPathForClsId(clsId, ".java"));
	}

	private Path getMetadataFile(int clsId) {

View on GitHub (pinned to e738a26571)

Solutions

  1. Clear the cache directory and let jadx rebuild it
  2. Verify the cache directory permissions are consistent
  3. Ensure no external process writes to the jadx cache directory
  4. Use a local, stable cache path

Example fix

// Clear the cache and restart:
// rm -rf ~/.jadx/cache
// Restart jadx-gui — it will rebuild the cache cleanly.
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify meta directory exists and is readable before enumeration
if (!Files.isDirectory(metaDir) || !Files.isReadable(metaDir)) {
    LOG.warn("Cache meta dir inaccessible, skipping enumeration");
}

Try / catch

try {
    diskCodeCache.loadCachedClasses();
} catch (JadxRuntimeException e) {
    if (e.getMessage().contains("enumerate cached classes")) {
        LOG.warn("Cache enumeration failed, starting fresh", e);
        FileUtils.deleteDirectory(metaDir.toFile());
    }
}

Prevention

When it happens

Trigger: loadCachedClasses() calls Files.walk(metaDir), iterates each file, parses filenames ending in .jadxmd by stripping the suffix and parsing the remaining hex string as an int. Integer.parseInt could throw NumberFormatException; the walk could throw IOException if metaDir is inaccessible. All are caught and wrapped.

Common situations: Cache directory deleted or moved between startup and this call. Non-cache files placed in the meta directory by external tools. Filesystem errors on a network-mounted cache. Corrupt or partial cache from a crash. Permission change on the cache directory.

Related errors


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