{"record":{"id":"57e565cf8a2ff2cd","repo":"quarkusio/quarkus","slug":"unable-to-initialize-zipfilesystem-archivepath","errorCode":null,"errorMessage":"Unable to initialize ZipFileSystem: ${archivePath}","messagePattern":"Unable to initialize ZipFileSystem: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/pkg/jar/ZipFileSystemArchiveCreator.java","lineNumber":45,"sourceCode":"    private static final Logger LOG = Logger.getLogger(ZipFileSystemArchiveCreator.class);\n\n    // we probably don't need the Windows entry but let's be safe\n    private static final Set<String> MANIFESTS = Set.of(\"META-INF/MANIFEST.MF\", \"META-INF\\\\MANIFEST.MF\");\n\n    private final FileSystem zipFileSystem;\n\n    private final Map<String, String> addedFiles = new HashMap<>();\n\n    public ZipFileSystemArchiveCreator(Path archivePath, boolean compressed, Instant entryTimestamp) {\n        try {\n            if (compressed) {\n                zipFileSystem = ZipUtils.createNewReproducibleZipFileSystem(archivePath, entryTimestamp);\n            } else {\n                zipFileSystem = ZipUtils.createNewReproducibleZipFileSystem(archivePath, Map.of(\"compressionMethod\", \"STORED\"),\n                        entryTimestamp);\n            }\n        } catch (IOException e) {\n            throw new RuntimeException(\"Unable to initialize ZipFileSystem: \" + archivePath, e);\n        }\n    }\n\n    @Override\n    public void addManifest(Manifest manifest) throws IOException {\n        Path manifestInFsPath = zipFileSystem.getPath(\"META-INF\", \"MANIFEST.MF\");\n        handleParentDirectories(manifestInFsPath, CURRENT_APPLICATION);\n        try (final OutputStream os = Files.newOutputStream(manifestInFsPath)) {\n            manifest.write(os);\n        }\n    }\n\n    @Override\n    public void addDirectory(String directory, String source) throws IOException {\n        if (addedFiles.putIfAbsent(directory, source) != null) {\n            return;\n        }\n        final Path targetInFsPath = zipFileSystem.getPath(directory);","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/pkg/jar/ZipFileSystemArchiveCreator.java#L27-L63","documentation":"Thrown by the ZipFileSystemArchiveCreator constructor when ZipUtils.createNewReproducibleZipFileSystem cannot open a reproducible ZIP filesystem over the target archive path, wrapping the IOException in a RuntimeException. Without this filesystem no jar entries can be written.","triggerScenarios":"Package step selecting the zipfs archive creator and creating the jar fails: invalid/unwritable archivePath, missing parent directories, file locked by another process, or unsupported/failed ZipFileSystem provider creation.","commonSituations":"Unwritable or already-open target jar (running app, IDE indexers); path length/permission problems on Windows; customized quarkus.package settings redirecting output to an invalid path; JDK issues with the zipfs provider.","solutions":["Verify the archivePath parent directory exists and is writable.","Make sure no other process holds the target jar open; stop the dev-mode app before packaging.","Run mvn clean to delete a corrupt/stale jar, then rebuild.","Check the wrapped IOException message for the concrete filesystem error (e.g. 'File already exists', 'Access denied').","Update/verify the JDK — zip filesystem provider bugs in some JDK builds can fail reproducible zips."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"Path archive = Path.of(\"target/quarkus-app/quarkus-run.jar\");\nif (!Files.isWritable(archive.getParent())) throw new IllegalStateException(\"Output dir not writable\");\ntry (var ignored = FileChannel.open(archive.toAbsolutePath().normalize(),\n        StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.DELETE_ON_CLOSE)) {\n    // OK: file is lockable/writable\n} catch (IOException e) { throw new IllegalStateException(\"Archive path unusable\", e); }","typeGuard":null,"tryCatchPattern":"try {\n    // package step\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Unable to initialize ZipFileSystem\")) {\n        log.error(\"ZipFileSystem init failed\", e.getCause());\n        // mvn clean, unlock file, verify JDK, retry\n    } else throw e;\n}","preventionTips":["Verify output directory permissions before packaging.","Close running apps that lock the jar.","Use a current JDK with a working zipfs provider.","mvn clean to remove corrupt stale jars."],"tags":["zipfilesystem","packaging","io"],"backgroundTag":"archive-creation-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}