{"record":{"id":"f149cf9fc0609d6b","repo":"quarkusio/quarkus","slug":"failed-to-read-f149cf","errorCode":null,"errorMessage":"Failed to read ","messagePattern":"Failed to read ","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/dependency/DependencyUtils.java","lineNumber":129,"sourceCode":"\n        File artifactFile = artifact.getFile();\n        if (!artifactFile.exists()) {\n            return null;\n        }\n\n        if (artifactFile.isDirectory()) {\n            Path descriptorPath = artifactFile.toPath().resolve(BootstrapConstants.DESCRIPTOR_PATH);\n            if (Files.isRegularFile(descriptorPath)) {\n                return createExtensionDependency(project, artifactId, descriptorPath);\n            }\n        } else if (ArtifactCoords.TYPE_JAR.equals(artifact.getExtension())) {\n            try (FileSystem artifactFs = ZipUtils.newFileSystem(artifactFile.toPath())) {\n                Path descriptorPath = artifactFs.getPath(BootstrapConstants.DESCRIPTOR_PATH);\n                if (Files.exists(descriptorPath)) {\n                    return createExtensionDependency(project, artifactId, descriptorPath);\n                }\n            } catch (IOException x) {\n                throw new GradleException(\"Failed to read \" + artifactFile, x);\n            }\n        }\n\n        return null;\n    }\n\n    public static ExtensionDependency<?> getExtensionInfoOrNull(Project project, Project extensionProject) {\n        boolean isIncludedBuild = !project.getRootProject().getGradle().equals(extensionProject.getRootProject().getGradle());\n\n        ModuleVersionIdentifier extensionArtifactId = DefaultModuleVersionIdentifier.newId(\n                extensionProject.getGroup().toString(),\n                extensionProject.getName(),\n                extensionProject.getVersion().toString());\n\n        Object extensionConfiguration = extensionProject\n                .getExtensions().findByName(ExtensionConstants.EXTENSION_CONFIGURATION_NAME);\n\n        // If there's an extension configuration file in the project resources it can override","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/dependency/DependencyUtils.java#L111-L147","documentation":"DependencyUtils.getExtensionInfoOrNull inspects a resolved JAR artifact to detect a Quarkus extension by opening it as a zip filesystem and looking for META-INF/quarkus-extension.properties (BootstrapConstants.DESCRIPTOR_PATH). If the zip cannot be opened or read (corrupt jar, not a real zip, truncated download), the IOException is wrapped in a GradleException so the build fails loudly instead of silently skipping a possibly-misnamed extension JAR.","triggerScenarios":"A resolved dependency with .jar extension whose file cannot be opened as a zip archive — corrupted local repository entry, partially downloaded artifact, empty or non-zip file named .jar — during extension detection while collecting application dependencies.","commonSituations":"Interrupted downloads leaving a truncated JAR in ~/.m2/repository or ~/.gradle/caches/modules-2; a fork/relocated project producing an invalid jar; CI cache corruption; proxy intercepting downloads.","solutions":["Delete the corrupted artifact from the local repository/cache and rebuild to re-download it (./gradlew --refresh-dependencies or rm the specific file)","Verify the JAR integrity: unzip -t <file> or compare the SHA with the one published on Maven Central","Check for disk-full or permission issues that could truncate writes to the cache","If behind a proxy/firewall, confirm it is not serving HTML error pages saved as .jar","Disable any artifact caching/mirroring layer (e.g. corporate Artifactory cache) temporarily to rule out a poisoned cache"],"exampleFix":"// before\n$ ls ~/.gradle/caches/modules-2/files-2.1/com.example/ext-jar/.../ext-1.0.jar\n# keep corrupted jar\n// after\n$ rm ~/.gradle/caches/modules-2/files-2.1/com.example/ext-jar -rf\n$ ./gradlew build --refresh-dependencies","handlingStrategy":"try-catch","validationCode":"File jar = artifact.getFile();\nif (jar.length() == 0 || !jar.canRead()) throw new IllegalStateException(\"Bad artifact: \" + jar);\n// integrity probe\ntry (var zin = new java.util.zip.ZipFile(jar)) { if (zin.getEntry(\"META-INF/quarkus-extension.properties\") == null) { /* not an ext */ } }\ncatch (java.util.zip.ZipException e) { throw new IllegalStateException(\"Corrupt jar: \" + jar); }","typeGuard":null,"tryCatchPattern":"try {\n    var info = DependencyUtils.getExtensionInfoOrNull(artifact);\n} catch (GradleException e) {\n    if (e.getMessage().startsWith(\"Failed to read \")) {\n        // delete the corrupt cached jar and refresh dependencies\n        Files.deleteIfExists(artifact.getFile().toPath());\n    } else throw e;\n}","preventionTips":["Use --refresh-dependencies after aborted downloads","Monitor for zero-length or truncated jars in ~/.gradle/caches and ~/.m2","Ensure proxies/mirrors serve binary artifacts unchanged","Check disk space before large dependency downloads"],"tags":["gradle","jar","zip","corrupt-artifact"],"backgroundTag":"corrupt-jar-cache","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}