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

  1. Delete the corrupt artifact from the local cache (find the path named in the error message) and re-resolve dependencies to re-download it.
  2. Run gradle --refresh-dependencies to force redownload.
  3. Check disk space and network stability if downloads keep truncating.
  4. 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

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


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/a9175856a54aefd7. Report an issue: GitHub.