quarkusio/quarkus · error · RuntimeException
Failed to read
Error message
Failed to read
What it means
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.
Source
Thrown at devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTask.java:521
}
return null;
}
private void computeQuarkusExtensions(ObjectNode extObject) {
ObjectNode metadataNode = getMetadataNode(extObject);
Set<ResolvedArtifact> extensions = new HashSet<>();
for (ResolvedArtifact resolvedArtifact : getClasspath().getResolvedConfiguration().getResolvedArtifacts()) {
if (resolvedArtifact.getExtension().equals("jar")) {
Path p = resolvedArtifact.getFile().toPath();
if (Files.isDirectory(p) && isExtension(p)) {
extensions.add(resolvedArtifact);
} else {
try (FileSystem fs = ZipUtils.newFileSystem(p)) {
if (isExtension(fs.getPath(""))) {
extensions.add(resolvedArtifact);
}
} catch (IOException e) {
throw new RuntimeException("Failed to read " + p, e);
}
}
}
}
ArrayNode extensionArray = metadataNode.putArray("extension-dependencies");
for (ResolvedArtifact extension : extensions) {
ModuleVersionIdentifier id = extension.getModuleVersion().getId();
extensionArray
.add(ArtifactKey.of(id.getGroup(), id.getName(), extension.getClassifier(), extension.getExtension())
.toGacString());
}
}
private String getQuarkusCoreVersionOrNull() {
for (ResolvedArtifact resolvedArtifact : getClasspath().getResolvedConfiguration().getResolvedArtifacts()) {
ModuleVersionIdentifier artifactId = resolvedArtifact.getModuleVersion().getId();
if (artifactId.getGroup().equals("io.quarkus") && artifactId.getName().equals("quarkus-core")) {
return artifactId.getVersion();View on GitHub (pinned to e1c734241f)
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.
Example fix
// before rm nothing; build fails on ~/.gradle/caches/.../broken-1.0.jar // after rm ~/.gradle/caches/modules-2/files-2.1/com.example/broken/1.0/.../broken-1.0.jar ./gradlew --refresh-dependencies extensionDescriptor/
Defensive patterns
Strategy: retry
Validate before calling
// verify each resolved artifact file is a readable non-empty zip before the task
resolvedArtifacts.each { a ->
def f = a.file
if (f == null || !f.isFile() || f.length() == 0) throw new IllegalStateException("Bad artifact file: ${a.id}")
if (!(f.bytes[0] == 0x50 && f.bytes[1] == 0x4B)) throw new IllegalStateException("Not a zip/jar: $f — clean your dependency cache")
} Try / catch
try {
computeQuarkusExtensions()
} catch (RuntimeException e) {
if (e.message?.startsWith('Failed to read ')) {
def p = e.message.minus('Failed to read ')
Files.deleteIfExists(Path.of(p.trim()))
// re-resolve dependencies to redownload, then retry
computeQuarkusExtensions()
} else throw e
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to restore the timestamp of the file:
- Unable to serialiaze gradle application model
- Failed to persist extension descriptor
- Failed to persist
- Failed to copy " + p + " to " + output
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/a9175856a54aefd7.
Report an issue: GitHub.