skylot/jadx · error · JadxRuntimeException
Failed to remove code cache for {}
Error message
Failed to remove code cache for {} What it means
DiskCodeCache.remove deletes the on-disk code and metadata files for a single class when it is being evicted or its write failed. If Files.deleteIfExists throws for either file, the exception is wrapped in a JadxRuntimeException naming the affected class.
Source
Thrown at jadx-gui/src/main/java/jadx/gui/cache/code/disk/DiskCodeCache.java:194
@Override
public void remove(String clsFullName) {
try {
CacheData clsData = getClsData(clsFullName);
if (clsData.isCached()) {
clsData.setCached(false);
if (clsData.getTmpCodeInfo() == null) {
LOG.debug("Removing class info from disk: {}", clsFullName);
int clsId = clsData.getClsId();
Files.deleteIfExists(getJavaFile(clsId));
Files.deleteIfExists(getMetadataFile(clsId));
} else {
// class info not yet written to disk
clsData.setTmpCodeInfo(null);
}
}
} catch (Exception e) {
throw new JadxRuntimeException("Failed to remove code cache for " + clsFullName, e);
}
}
private String buildCodeVersion(JadxArgs args, @Nullable JadxDecompiler decompiler) {
List<File> inputFiles = new ArrayList<>(args.getInputFiles());
if (args.getGeneratedRenamesMappingFileMode().shouldRead()
&& args.getGeneratedRenamesMappingFile() != null
&& args.getGeneratedRenamesMappingFile().exists()) {
inputFiles.add(args.getGeneratedRenamesMappingFile());
}
return DATA_FORMAT_VERSION
+ ":" + Jadx.getVersion()
+ ":" + args.makeCodeArgsHash(decompiler)
+ ":" + FileUtils.buildInputsHash(Utils.collectionMap(inputFiles, File::toPath));
}
private CacheData getClsData(String clsFullName) {
CacheData clsData = clsDataMap.get(clsFullName);View on GitHub (pinned to e738a26571)
Solutions
- Ensure only one jadx instance uses the cache directory
- Add an antivirus exclusion for the jadx cache directory
- Move the cache to a local filesystem
- Manually clear the cache and restart jadx
Example fix
// Add antivirus exclusion (Windows example): // Add C:\Users\<you>\.jadx\cache to Windows Defender exclusions // No code fix — this is internal cache management.
Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure cache directory is not locked by another process
if (!Files.isWritable(metaFile)) { LOG.warn("Cache file locked, skip removal"); } Try / catch
try {
diskCodeCache.remove(clsName);
} catch (JadxRuntimeException e) {
LOG.debug("Non-fatal: could not remove cache for " + clsName, e);
// non-critical; cache will be rebuilt on next run
} Prevention
- Run a single jadx instance per cache directory
- Add antivirus exclusions for the cache path
- Treat cache removal failures as non-fatal
When it happens
Trigger: remove() is called after a cache write failure (in the add() catch block) or when a class is explicitly removed. It calls Files.deleteIfExists on both the .java and .jadx.md files. If the OS denies deletion (file locked, permission) or an I/O error occurs, the exception fires.
Common situations: File locked by another process (antivirus scanning the just-written file, indexer). Permission denied on cache files. Cache on a filesystem that does not support delete-while-open (some network FS). Another jadx instance accessing the same cache.
Related errors
- Failed to reset code cache
- Failed to write metadata file
- Failed to enumerate cached classes
- Failed to write caches file
- Resource file save error
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/37a56e975b8946b3.
Report an issue: GitHub.