quarkusio/quarkus · error · IllegalStateException

Failed to read ${f}

Error message

Failed to read ${f}

What it means

When reading the extension descriptor from a project artifact file (jar/zip), any Throwable during opening the zip filesystem or reading the descriptor is wrapped in IllegalStateException('Failed to read <file>').

Source

Thrown at independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java:1150

        }
        try {
            if (f.isDirectory()) {
                return readExtensionDescriptorIfExists(f.toPath());
            }
            // In case of a parallel build, the resolved JAR might not have been fully written, which may result in a failure to read it
            // so we try the classes dir first
            if (session.isParallel()) {
                final LocalProject localProject = workspaceProvider.getProject(a.getGroupId(), a.getArtifactId());
                final Path classesDir = localProject == null ? null : localProject.getClassesDir();
                if (classesDir != null && Files.exists(classesDir)) {
                    return readExtensionDescriptorIfExists(classesDir);
                }
            }
            try (FileSystem fs = ZipUtils.newFileSystem(f.toPath())) {
                return readExtensionDescriptorIfExists(fs.getPath(""));
            }
        } catch (Throwable e) {
            throw new IllegalStateException("Failed to read " + f, e);
        }
    }

    private Properties readExtensionDescriptorIfExists(final Path classesDir) throws IOException {
        final Path p = getExtensionDescriptorOrNull(classesDir);
        return p == null ? null : readExtensionDescriptor(p);
    }

    private Path getExtensionDescriptorOrNull(Path runtimeExtRootDir) {
        final Path p = runtimeExtRootDir.resolve(BootstrapConstants.DESCRIPTOR_PATH);
        return Files.exists(p) ? p : null;
    }

    private Properties readExtensionDescriptor(final Path extDescr) throws IOException {
        final Properties props = new Properties();
        try (BufferedReader reader = Files.newBufferedReader(extDescr)) {
            props.load(reader);
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure the project jar is built before running extension-descriptor (mvn package first)
  2. Delete and re-download the corrupted artifact from the local repository
  3. Check file exists and is readable at the printed path
  4. If the file is not a jar (e.g. pom packaging), verify the mojo is only applied to jar-packaged extension modules

Example fix

# before: jar not built
mvn extension-descriptor -pl my-ext
# after
mvn package extension-descriptor -pl my-ext
Defensive patterns

Strategy: validation

Validate before calling

test -f target/my-ext-1.0.0.jar && unzip -t target/my-ext-1.0.0.jar

Prevention

When it happens

Trigger: getDeploymentArtifact / descriptor reading path: ZipUtils.newFileSystem(f.toPath()) fails because the file is not a valid zip/jar, is missing, or is unreadable.

Common situations: Target jar not yet built when mojo runs; corrupt artifact in local repo; wrong path passed; permission problems on CI.

Related errors


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