{"record":{"id":"37a56e975b8946b3","repo":"skylot/jadx","slug":"failed-to-remove-code-cache-for","errorCode":null,"errorMessage":"Failed to remove code cache for {}","messagePattern":"Failed to remove code cache for (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-gui/src/main/java/jadx/gui/cache/code/disk/DiskCodeCache.java","lineNumber":194,"sourceCode":"\n\t@Override\n\tpublic void remove(String clsFullName) {\n\t\ttry {\n\t\t\tCacheData clsData = getClsData(clsFullName);\n\t\t\tif (clsData.isCached()) {\n\t\t\t\tclsData.setCached(false);\n\t\t\t\tif (clsData.getTmpCodeInfo() == null) {\n\t\t\t\t\tLOG.debug(\"Removing class info from disk: {}\", clsFullName);\n\t\t\t\t\tint clsId = clsData.getClsId();\n\t\t\t\t\tFiles.deleteIfExists(getJavaFile(clsId));\n\t\t\t\t\tFiles.deleteIfExists(getMetadataFile(clsId));\n\t\t\t\t} else {\n\t\t\t\t\t// class info not yet written to disk\n\t\t\t\t\tclsData.setTmpCodeInfo(null);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tthrow new JadxRuntimeException(\"Failed to remove code cache for \" + clsFullName, e);\n\t\t}\n\t}\n\n\tprivate String buildCodeVersion(JadxArgs args, @Nullable JadxDecompiler decompiler) {\n\t\tList<File> inputFiles = new ArrayList<>(args.getInputFiles());\n\t\tif (args.getGeneratedRenamesMappingFileMode().shouldRead()\n\t\t\t\t&& args.getGeneratedRenamesMappingFile() != null\n\t\t\t\t&& args.getGeneratedRenamesMappingFile().exists()) {\n\t\t\tinputFiles.add(args.getGeneratedRenamesMappingFile());\n\t\t}\n\t\treturn DATA_FORMAT_VERSION\n\t\t\t\t+ \":\" + Jadx.getVersion()\n\t\t\t\t+ \":\" + args.makeCodeArgsHash(decompiler)\n\t\t\t\t+ \":\" + FileUtils.buildInputsHash(Utils.collectionMap(inputFiles, File::toPath));\n\t}\n\n\tprivate CacheData getClsData(String clsFullName) {\n\t\tCacheData clsData = clsDataMap.get(clsFullName);","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-gui/src/main/java/jadx/gui/cache/code/disk/DiskCodeCache.java#L176-L212","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// Add antivirus exclusion (Windows example):\n// Add C:\\Users\\<you>\\.jadx\\cache to Windows Defender exclusions\n// No code fix — this is internal cache management.","handlingStrategy":"try-catch","validationCode":"// Ensure cache directory is not locked by another process\nif (!Files.isWritable(metaFile)) { LOG.warn(\"Cache file locked, skip removal\"); }","typeGuard":null,"tryCatchPattern":"try {\n    diskCodeCache.remove(clsName);\n} catch (JadxRuntimeException e) {\n    LOG.debug(\"Non-fatal: could not remove cache for \" + clsName, e);\n    // non-critical; cache will be rebuilt on next run\n}","preventionTips":["Run a single jadx instance per cache directory","Add antivirus exclusions for the cache path","Treat cache removal failures as non-fatal"],"tags":["cache","io","filesystem","permissions","jadx-gui"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}