quarkusio/quarkus · error · RuntimeException

Error joining byte arrays

Error message

Error joining byte arrays

What it means

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.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/pkg/jar/ZipFileSystemArchiveCreator.java:187

        if (targetInFsPath.getParent() != null) {
            Files.createDirectories(targetInFsPath.getParent());
        }
    }

    private static byte[] joinWithNewlines(List<byte[]> lines) {
        try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
            for (byte[] line : lines) {
                if (line.length == 0) {
                    continue;
                }
                out.write(line);
                if (line[line.length - 1] != '\n') {
                    out.write('\n');
                }
            }
            return out.toByteArray();
        } catch (Exception e) {
            throw new RuntimeException("Error joining byte arrays", e);
        }
    }

    @Override
    public void close() {
        try {
            zipFileSystem.close();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect the wrapped cause in the stack trace — it contains the real error.
  2. Increase build memory (MAVEN_OPTS="-Xmx4g") if cause is an OutOfMemoryError.
  3. Rebuild with a different package type (e.g. default fast-jar creator) to isolate the zipfs creator.
  4. If caused by local modifications to ZipFileSystemArchiveCreator, fix the try-block code.
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure sufficient build memory
// MAVEN_OPTS="-Xmx4g" ./mvnw clean package

Try / catch

try {
    // package build
} catch (RuntimeException e) {
    if ("Error joining byte arrays".equals(e.getMessage())) {
        log.error("Zipfs packaging join failed", e.getCause());
    } else throw e;
}

Prevention

When it happens

Trigger: addFile called with multi-line content during zipfs-based packaging and the byte-joining loop (write/concat/append newline) throws.

Common situations: Memory pressure with very large path/class lists; IO wrapped errors; bugs in modified packaging code.

Related errors


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