quarkusio/quarkus · error · IllegalStateException

Unable to create archive: ${archivePath}

Error message

Unable to create archive: ${archivePath}

What it means

Thrown when closing the ParallelCommonsCompressArchiveCreator fails to finalize the jar archive: writing scattered/directory entries to the ZipArchiveOutputStream raised an IOException, the scatter zip threads were interrupted, or a parallel write task failed with ExecutionException.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/pkg/jar/ParallelCommonsCompressArchiveCreator.java:313

                // we add the manifest directly to the final archive to make sure it is the first element added
                // (except for the META-INF/ directory that is allowed first)
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                manifest.write(baos);
                byte[] manifestBytes = baos.toByteArray();

                ZipArchiveEntry manifestEntry = new ZipArchiveEntry("META-INF/MANIFEST.MF");
                normalizeTimestampsAndPermissions(manifestEntry);
                manifestEntry.setSize(manifestBytes.length);
                archive.putArchiveEntry(manifestEntry);
                archive.write(manifestBytes);
                archive.closeArchiveEntry();
            }

            directories.writeTo(archive);
            directories.close();
            scatterZipCreator.writeTo(archive);
        } catch (IOException | InterruptedException | ExecutionException e) {
            throw new IllegalStateException("Unable to create archive: " + archivePath, e);
        }
        try {
            Files.deleteIfExists(tempDirectory);
        } catch (Exception e) {
            // noop, it's not a big deal to keep this directory around
        }
    }

    private static class DoNotShutdownDelegatingExecutorService implements ExecutorService {

        private final ExecutorService delegate;

        private DoNotShutdownDelegatingExecutorService(ExecutorService delegate) {
            this.delegate = delegate;
        }

        @Override
        public void shutdown() {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check free disk space and permissions in the target build directory.
  2. Ensure no other process (running app, IDE, antivirus) holds the output jar; stop the app and rebuild.
  3. Re-run ./mvnw clean package to remove stale partial artifacts.
  4. Inspect the wrapped cause (IOException vs InterruptedException vs ExecutionException) for the real problem.
  5. Avoid building onto network filesystems; use local storage.

Example fix

// before
$ mvn package  # fails: Unable to create archive: .../quarkus-app/...jar
// after
$ mvn clean package  # after freeing disk space / stopping the process locking the jar
Defensive patterns

Strategy: try-catch

Validate before calling

import java.nio.file.*;
Path jar = Path.of("target/quarkus-app/quarkus-run.jar");
if (!Files.isWritable(jar.getParent())) throw new IllegalStateException("Build output not writable");
if (Files.getUsableSpace(jar.getParent()) < 512L*1024*1024) throw new IllegalStateException("Low disk");

Try / catch

try {
    // packaging build
} catch (IllegalStateException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Unable to create archive")) {
        log.error("Archive finalize failed", e.getCause());
        // free disk / unlock jar / mvn clean and retry
    } else throw e;
}

Prevention

When it happens

Trigger: JarOutputStream close() during fast-jar packaging while scatterZipCreator.writeTo(archive) or directories.writeTo fails; disk full on the output volume; another process holding/locking the target jar; thread interruption during packaging.

Common situations: Full or quota-limited disk in CI; target jar locked by a running application or IDE; slow/flaky filesystems (NFS, network shares); OOM killing scatter threads.

Related errors


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