{"record":{"id":"a9175856a54aefd7","repo":"quarkusio/quarkus","slug":"failed-to-read","errorCode":null,"errorMessage":"Failed to read ","messagePattern":"Failed to read ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTask.java","lineNumber":521,"sourceCode":"        }\n        return null;\n    }\n\n    private void computeQuarkusExtensions(ObjectNode extObject) {\n        ObjectNode metadataNode = getMetadataNode(extObject);\n        Set<ResolvedArtifact> extensions = new HashSet<>();\n        for (ResolvedArtifact resolvedArtifact : getClasspath().getResolvedConfiguration().getResolvedArtifacts()) {\n            if (resolvedArtifact.getExtension().equals(\"jar\")) {\n                Path p = resolvedArtifact.getFile().toPath();\n                if (Files.isDirectory(p) && isExtension(p)) {\n                    extensions.add(resolvedArtifact);\n                } else {\n                    try (FileSystem fs = ZipUtils.newFileSystem(p)) {\n                        if (isExtension(fs.getPath(\"\"))) {\n                            extensions.add(resolvedArtifact);\n                        }\n                    } catch (IOException e) {\n                        throw new RuntimeException(\"Failed to read \" + p, e);\n                    }\n                }\n            }\n        }\n        ArrayNode extensionArray = metadataNode.putArray(\"extension-dependencies\");\n        for (ResolvedArtifact extension : extensions) {\n            ModuleVersionIdentifier id = extension.getModuleVersion().getId();\n            extensionArray\n                    .add(ArtifactKey.of(id.getGroup(), id.getName(), extension.getClassifier(), extension.getExtension())\n                            .toGacString());\n        }\n    }\n\n    private String getQuarkusCoreVersionOrNull() {\n        for (ResolvedArtifact resolvedArtifact : getClasspath().getResolvedConfiguration().getResolvedArtifacts()) {\n            ModuleVersionIdentifier artifactId = resolvedArtifact.getModuleVersion().getId();\n            if (artifactId.getGroup().equals(\"io.quarkus\") && artifactId.getName().equals(\"quarkus-core\")) {\n                return artifactId.getVersion();","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTask.java#L503-L539","documentation":"Thrown by ExtensionDescriptorTask.computeQuarkusExtensions when opening a resolved artifact JAR as a zip filesystem (ZipUtils.newFileSystem) to check whether it is a Quarkus extension fails with an IOException. The artifact path is wrapped in a RuntimeException naming the unreadable path.","triggerScenarios":"A dependency artifact file at path p cannot be opened as a ZIP — corrupted or truncated jar in the local Gradle/Maven cache, an empty/0-byte file, a non-zip artifact mistakenly on the resolved artifact set, or a file deleted between resolution and read.","commonSituations":"Interrupted downloads leaving corrupt jars in ~/.gradle/caches or ~/.m2/repository, disk-full during dependency download, VPN/proxy producing partial files, or artifacts replaced concurrently.","solutions":["Delete the corrupt artifact from the local cache (find the path named in the error message) and re-resolve dependencies to re-download it.","Run gradle --refresh-dependencies to force redownload.","Check disk space and network stability if downloads keep truncating.","If a non-jar artifact is being scanned, verify the dependency configuration filtering only includes jar-type artifacts."],"exampleFix":"// before\nrm nothing; build fails on ~/.gradle/caches/.../broken-1.0.jar\n// after\nrm ~/.gradle/caches/modules-2/files-2.1/com.example/broken/1.0/.../broken-1.0.jar\n./gradlew --refresh-dependencies extensionDescriptor/","handlingStrategy":"retry","validationCode":"// verify each resolved artifact file is a readable non-empty zip before the task\nresolvedArtifacts.each { a ->\n  def f = a.file\n  if (f == null || !f.isFile() || f.length() == 0) throw new IllegalStateException(\"Bad artifact file: ${a.id}\")\n  if (!(f.bytes[0] == 0x50 && f.bytes[1] == 0x4B)) throw new IllegalStateException(\"Not a zip/jar: $f — clean your dependency cache\")\n}","typeGuard":null,"tryCatchPattern":"try {\n  computeQuarkusExtensions()\n} catch (RuntimeException e) {\n  if (e.message?.startsWith('Failed to read ')) {\n    def p = e.message.minus('Failed to read ')\n    Files.deleteIfExists(Path.of(p.trim()))\n    // re-resolve dependencies to redownload, then retry\n    computeQuarkusExtensions()\n  } else throw e\n}","preventionTips":["Use --refresh-dependencies or delete cache entries when downloads are interrupted.","Ensure stable network/proxy settings for dependency downloads; avoid flaky VPNs mid-build.","Monitor free disk space where Gradle/Maven caches live.","Don't mutate the dependency cache while a build is running."],"tags":["gradle","ioexception","corrupt-jar","dependency-cache"],"backgroundTag":"corrupt-artifact-cache","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}