{"record":{"id":"709989394f33caf6","repo":"skylot/jadx","slug":"failed-to-reset-code-cache","errorCode":null,"errorMessage":"Failed to reset code cache","messagePattern":"Failed to reset code cache","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-gui/src/main/java/jadx/gui/cache/code/disk/DiskCodeCache.java","lineNumber":95,"sourceCode":"\t}\n\n\tprivate void reset() {\n\t\ttry {\n\t\t\tlong start = System.currentTimeMillis();\n\t\t\tLOG.info(\"Resetting disk code cache, base dir: {}\", baseDir.toAbsolutePath());\n\t\t\tFileUtils.deleteDirIfExists(baseDir);\n\t\t\tif (Files.exists(baseDir.getParent().resolve(codeVersionFile.getFileName()))) {\n\t\t\t\t// remove old version cache files\n\t\t\t\tFileUtils.deleteDirIfExists(baseDir.getParent());\n\t\t\t}\n\t\t\tFileUtils.makeDirs(srcDir);\n\t\t\tFileUtils.makeDirs(metaDir);\n\t\t\tFileUtils.writeFile(codeVersionFile, codeVersion);\n\t\t\tif (LOG.isDebugEnabled()) {\n\t\t\t\tLOG.info(\"Reset done in: {}ms\", System.currentTimeMillis() - start);\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tthrow new JadxRuntimeException(\"Failed to reset code cache\", e);\n\t\t} finally {\n\t\t\tclsDataMap.values().forEach(d -> d.setCached(false));\n\t\t}\n\t}\n\n\t/**\n\t * Async writes backed by in-memory store\n\t */\n\t@Override\n\tpublic void add(String clsFullName, ICodeInfo codeInfo) {\n\t\tCacheData clsData = getClsData(clsFullName);\n\t\tclsData.setTmpCodeInfo(codeInfo);\n\t\tclsData.setCached(true);\n\t\twritePool.execute(() -> {\n\t\t\ttry {\n\t\t\t\tint clsId = clsData.getClsId();\n\t\t\t\tICodeInfo code = clsData.getTmpCodeInfo();\n\t\t\t\tif (code != null) {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-gui/src/main/java/jadx/gui/cache/code/disk/DiskCodeCache.java#L77-L113","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Close all other jadx instances before resetting","Check and fix permissions on the cache directory","Move the cache to a local, non-synced directory","Free disk space","Manually delete the cache directory and retry"],"exampleFix":"// Configure a clean, local cache directory in jadx-gui settings,\n// or manually delete the cache before starting jadx:\nPath cache = Paths.get(System.getProperty(\"user.home\"), \".jadx\", \"cache\");\nFileUtils.deleteDirectory(cache.toFile());","handlingStrategy":"try-catch","validationCode":"// Verify cache dir is writable and not locked before reset\nif (!Files.isWritable(baseDir.getParent())) { throw new IllegalStateException(\"Cannot reset cache\"); }","typeGuard":null,"tryCatchPattern":"try {\n    diskCodeCache.reset();\n} catch (JadxRuntimeException e) {\n    if (e.getMessage().contains(\"Failed to reset code cache\")) {\n        LOG.warn(\"Manual cache clear needed\", e);\n        FileUtils.deleteDirectory(baseDir.toFile()); // user-initiated\n    }\n}","preventionTips":["Close all jadx instances before resetting cache","Keep cache on local, non-synced storage","Check permissions after OS updates"],"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"}