quarkusio/quarkus · error · RuntimeException

Error creating the openshift binary build archive.

Error message

Error creating the openshift binary build archive.

What it means

OpenshiftProcessor.createContainerImageAndGetObservedReference packages the Quarkus application output (runner jar/classes plus additional files) into a binary build archive that is uploaded to OpenShift for a binary S2I build. Any failure during Packaging.packageFile or while renaming the archive via a temp file move is wrapped in this RuntimeException.

Source

Thrown at extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/OpenshiftProcessor.java:405

        createContainerImageAndGetObservedReference(kubernetesClientBuilder, openshiftManifests, openshiftConfig, base,
                output, additional);
    }

    private static Optional<String> createContainerImageAndGetObservedReference(
            KubernetesClientBuilder kubernetesClientBuilder,
            GeneratedFileSystemResourceBuildItem openshiftManifests,
            ContainerImageOpenshiftConfig openshiftConfig,
            String base,
            Path output,
            Path... additional) {
        File tar;
        try {
            File original = Packaging.packageFile(output, base, additional);
            //Let's rename the archive and give it a more descriptive name, as it may appear in the logs.
            tar = Files.createTempFile("quarkus-", "-openshift").toFile();
            Files.move(original.toPath(), tar.toPath(), StandardCopyOption.REPLACE_EXISTING);
        } catch (Exception e) {
            throw new RuntimeException("Error creating the openshift binary build archive.", e);
        }

        try (KubernetesClient client = kubernetesClientBuilder.build()) {
            OpenShiftClient openShiftClient = toOpenshiftClient(client);
            KubernetesList kubernetesList = Serialization
                    .unmarshalAsList(new ByteArrayInputStream(openshiftManifests.getData()));

            List<HasMetadata> buildResources = kubernetesList.getItems().stream()
                    .filter(i -> i instanceof BuildConfig || i instanceof ImageStream || i instanceof Secret)
                    .collect(Collectors.toList());

            applyOpenshiftResources(openShiftClient, buildResources);
            return openshiftBuild(buildResources, tar, openshiftConfig, kubernetesClientBuilder);
        } finally {
            try {
                tar.delete();
            } catch (Exception e) {
                LOG.warn("Unable to delete temporary file " + tar.toPath().toAbsolutePath(), e);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the 'Caused by' exception: it names the actual I/O failure (missing file, disk full, permissions) and fix that root cause.
  2. Run the package phase first (mvn package) so the runner jar/classes exist before the OpenShift binary build.
  3. Free disk space or point java.io.tmpdir at a directory with capacity and write permissions.
  4. On Windows, ensure no process (IDE, antivirus) holds a lock on target/ artifacts, then retry the build.
  5. Clean the build output (mvn clean) and rebuild to rule out stale/corrupt packaging artifacts.

Example fix

// before: building OpenShift image without packaging
./mvnw quarkus:build -Dquarkus.container-image.build=true

// after: package first, then build image
./mvnw clean package -Dquarkus.container-image.build=true
Defensive patterns

Strategy: try-catch

Validate before calling

Path runner = Path.of("target", "quarkus-app", "quarkus-run.jar");
if (Files.notExists(runner)) {
    throw new IllegalStateException("Run 'mvn package' before the OpenShift binary build: missing " + runner);
}
Files.getFileStore(Path.of(System.getProperty("java.io.tmpdir"))).getTotalSpace(); // tmpdir reachable

Try / catch

try {
    // trigger openshift image build
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Error creating the openshift binary build archive.")) {
        Throwable root = e.getCause();
        // inspect root: missing file / disk full / permissions and retry after cleanup
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling the OpenShift image build path (openshiftBuildFromJar, builtContainerImage, or createContainerImage) when Packaging.packageFile cannot read/write the packaged output (missing runner artifact, locked file, full disk) or Files.move onto the 'quarkus-*-openshift' temp file fails.

Common situations: Running the build without a previously produced runner jar in binary mode; disk quota exhaustion in the temp directory; file permission problems or antivirus locking the output jar on Windows; corrupt/incomplete build output.

Related errors


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