quarkusio/quarkus · error · IllegalStateException

Build:%s failed! %s

Error message

Build:%s failed! %s

What it means

The OpenShift S2I build started by Quarkus failed. waitForOpenshiftBuild detects Build status Failed and throws IllegalStateException including the build name and the status message reported by the cluster.

Source

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

                            Reader reader = new InputStreamReader(w.getOutput())) {
                        display(reader, openshiftConfig.buildLogLevel());
                    } catch (IOException | KubernetesClientException ex) {
                        // This may happen if the LogWatch is closed while we are still reading.
                        // We shouldn't let the build fail, so let's log a warning and display last few lines of the log
                        LOG.warn("Log stream closed, redisplaying last " + LOG_TAIL_SIZE + " entries:");
                        try {
                            display(client.builds().withName(buildName).tailingLines(LOG_TAIL_SIZE).getLogReader(),
                                    Logger.Level.WARN);
                        } catch (IOException | KubernetesClientException ignored) {
                            // Let's ignore this.
                        }
                    }
                } else if (isComplete(updated)) {
                    return updated;
                } else if (isCancelled(updated)) {
                    throw new IllegalStateException("Build:" + buildName + " cancelled!");
                } else if (isFailed(updated)) {
                    throw new IllegalStateException(
                            "Build:" + buildName + " failed! " + updated.getStatus().getMessage());
                } else if (isError(updated)) {
                    throw new IllegalStateException(
                            "Build:" + buildName + " encountered error! " + updated.getStatus().getMessage());
                }
            }
        }
        return build;
    }

    static Optional<String> observedImageReference(Build build) {
        if (build == null || build.getStatus() == null) {
            return Optional.empty();
        }
        return Optional.ofNullable(build.getStatus().getOutputDockerImageReference())
                .filter(image -> !image.isBlank());
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the status message in the exception and the full build log: oc logs build/<buildName> to see the failing step.
  2. Fix the root cause in the log: registry credentials, proxy/egress settings, or build errors inside the builder image.
  3. Verify quota and node resources: oc describe quota; check the build pod events.
  4. If a base-image tag was moved/removed, update the S2I image reference or Quarkus version so it resolves.
  5. Re-run the build after fixing to confirm the build reaches Complete.
Defensive patterns

Strategy: try-catch

Validate before calling

oc get build <buildName> -o jsonpath='{.status.phase}'
oc logs build/<buildName> // inspect failing step before rerunning

Try / catch

try {
    // quarkus openshift build
} catch (IllegalStateException e) {
    if (e.getMessage() != null && e.getMessage().contains("failed!")) {
        String detail = e.getMessage(); // includes Build status message from the cluster
        // fetch oc logs build/<name>, fix registry/network/build error, rebuild
    }
    throw e;
}

Prevention

When it happens

Trigger: During the polling loop, isFailed(updated) becomes true — the build pod itself failed: base-image pull errors, failing S2I steps (dependency download, compile inside the builder image), or a Dockerfile/binary input error, all surfacing as Build status Failed with a message.

Common situations: Builder image cannot be pulled due to registry auth/network; Maven/Gradle dependency downloads fail inside the cluster (no internet/egress restrictions); bad application code compiled inside the S2I builder; insufficient quota causing pod eviction.

Related errors


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