{"record":{"id":"1de3b3eed4ea9eda","repo":"gradle/gradle","slug":"failed-to-hash","errorCode":null,"errorMessage":"Failed to hash {}","messagePattern":"Failed to hash (.+?)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"platforms/jvm/language-java/src/main/java/org/gradle/api/internal/tasks/compile/incremental/classpath/DefaultClassSetAnalyzer.java","lineNumber":143,"sourceCode":"            }\n        }\n\n        protected abstract HashCode getHashCode(FileVisitDetails fileDetails);\n    }\n\n    private class JarEntryVisitor extends EntryVisitor {\n\n        public JarEntryVisitor(ClassDependentsAccumulator accumulator, boolean abiOnly) {\n            super(accumulator, abiOnly);\n        }\n\n        @Override\n        protected HashCode getHashCode(FileVisitDetails fileDetails) {\n            InputStream inputStream = fileDetails.open();\n            try {\n                return hasher.hash(inputStream);\n            } catch (IOException e) {\n                throw new UncheckedIOException(\"Failed to hash \" + fileDetails, e);\n            } finally {\n                IoActions.closeQuietly(inputStream);\n            }\n        }\n    }\n\n    private class DirectoryEntryVisitor extends EntryVisitor {\n\n        public DirectoryEntryVisitor(ClassDependentsAccumulator accumulator, boolean abiOnly) {\n            super(accumulator, abiOnly);\n        }\n\n        @Override\n        protected HashCode getHashCode(FileVisitDetails fileDetails) {\n            return fileHasher.hash(fileDetails.getFile(), fileDetails.getSize(), fileDetails.getLastModified());\n        }\n    }\n","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/gradle/gradle/blob/534f27719b66953f95cc907aae7f2c1b12f5482d/platforms/jvm/language-java/src/main/java/org/gradle/api/internal/tasks/compile/incremental/classpath/DefaultClassSetAnalyzer.java#L125-L161","documentation":"DefaultClassSetAnalyzer hashes classpath entries for ABI analysis (compile avoidance / up-to-date checks). JarEntryVisitor.getHashCode wraps any IOException while reading a jar entry to hash it as UncheckedIOException('Failed to hash <entry>'), naming the offending file so it can be inspected.","triggerScenarios":"Compile-avoidance hashing walks the compile classpath and a jar entry cannot be opened/read: corrupted zip central directory, truncated jar from an interrupted download, file lock (Windows/AV), or a jar replaced on disk mid-build.","commonSituations":"Broken artifacts in ~/.gradle/caches or a local libs directory; NFS/network filesystems with flaky reads; two builds sharing one cache dir; antivirus locking jars on Windows.","solutions":["Test the jar named in the message: unzip -t <jar> — if it fails, the artifact is corrupt","Delete and re-fetch it: remove the module from ~/.gradle/caches/modules-2 or run ./gradlew --refresh-dependencies","Stop concurrent processes sharing the same Gradle caches, or give each build its own GRADLE_USER_HOME","On Windows, exclude the Gradle cache directories from antivirus scanning"],"exampleFix":"# before: reuse of a corrupt cached jar\n# after\n./gradlew --refresh-dependencies build","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add unzip -t checks for local/vendor jars in CI setup steps","Give concurrent builds separate GRADLE_USER_HOME directories","Exclude Gradle caches from antivirus scanning on Windows"],"tags":["java","classpath","compile-avoidance","jar","io"],"backgroundTag":"corrupted-jar-entry","analyzedSha":"534f27719b66953f95cc907aae7f2c1b12f5482d","analyzedAt":"2026-08-22T08:09:12.375Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}