{"record":{"id":"1195abf5b9bfe94b","repo":"quarkusio/quarkus","slug":"error-joining-byte-arrays-1195ab","errorCode":null,"errorMessage":"Error joining byte arrays","messagePattern":"Error joining byte arrays","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/pkg/jar/ZipFileSystemArchiveCreator.java","lineNumber":187,"sourceCode":"        if (targetInFsPath.getParent() != null) {\n            Files.createDirectories(targetInFsPath.getParent());\n        }\n    }\n\n    private static byte[] joinWithNewlines(List<byte[]> lines) {\n        try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {\n            for (byte[] line : lines) {\n                if (line.length == 0) {\n                    continue;\n                }\n                out.write(line);\n                if (line[line.length - 1] != '\\n') {\n                    out.write('\\n');\n                }\n            }\n            return out.toByteArray();\n        } catch (Exception e) {\n            throw new RuntimeException(\"Error joining byte arrays\", e);\n        }\n    }\n\n    @Override\n    public void close() {\n        try {\n            zipFileSystem.close();\n        } catch (IOException e) {\n            throw new UncheckedIOException(e);\n        }\n    }\n}\n","sourceCodeStart":169,"sourceCodeEnd":200,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/pkg/jar/ZipFileSystemArchiveCreator.java#L169-L200","documentation":"Thrown by joinWithNewlines in ZipFileSystemArchiveCreator when joining line byte arrays (such as classpath/path lists) into a single byte array fails, wrapping any Exception in a RuntimeException. It propagates from addFile while writing entries through the zip filesystem.","triggerScenarios":"addFile called with multi-line content during zipfs-based packaging and the byte-joining loop (write/concat/append newline) throws.","commonSituations":"Memory pressure with very large path/class lists; IO wrapped errors; bugs in modified packaging code.","solutions":["Inspect the wrapped cause in the stack trace — it contains the real error.","Increase build memory (MAVEN_OPTS=\"-Xmx4g\") if cause is an OutOfMemoryError.","Rebuild with a different package type (e.g. default fast-jar creator) to isolate the zipfs creator.","If caused by local modifications to ZipFileSystemArchiveCreator, fix the try-block code."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure sufficient build memory\n// MAVEN_OPTS=\"-Xmx4g\" ./mvnw clean package","typeGuard":null,"tryCatchPattern":"try {\n    // package build\n} catch (RuntimeException e) {\n    if (\"Error joining byte arrays\".equals(e.getMessage())) {\n        log.error(\"Zipfs packaging join failed\", e.getCause());\n    } else throw e;\n}","preventionTips":["Inspect the wrapped cause first.","Provide adequate heap for large class lists.","Prefer the default (non-zipfs) creator unless reproducible store-mode zips are needed.","Keep archive-creator customizations covered by tests."],"tags":["packaging","io","byte-array"],"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-14T00:17:10.932Z"}