quarkusio/quarkus · error · IllegalStateException

Build:%s encountered error! %s

Error message

Build:%s encountered error! %s

What it means

The OpenShift build encountered an internal error. waitForOpenshiftBuild checks isError(updated) and throws IllegalStateException containing the build name and the cluster-reported error message, distinguishing this failure mode from a build that merely Failed (which would point at the build steps themselves).

Source

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

                        // 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());
    }

    public static Predicate<HasMetadata> distinctByResourceKey() {
        Map<Object, Boolean> seen = new ConcurrentHashMap<>();
        return t -> seen.putIfAbsent(t.getApiVersion() + "/" + t.getKind() + ":" + t.getMetadata().getName(),

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the exception's status message and cluster events: oc get events and oc describe build <buildName> to identify the infrastructure failure.
  2. Check node and control-plane health (oc get nodes, openshift-controller-manager logs) and re-run the build once the cluster is healthy.
  3. Increase build pod resources if OOM-killed (adjust build pod resources via BuildConfig or Quarkus config).
  4. Retry the Quarkus OpenShift build; Error states are often transient infrastructure failures.
  5. If persistent, open an issue with the OpenShift administrators including the build name from the exception.
Defensive patterns

Strategy: retry

Validate before calling

oc get nodes // verify node health
oc get events -n <namespace> | grep -i build

Try / catch

try {
    // quarkus openshift build
} catch (IllegalStateException e) {
    if (e.getMessage() != null && e.getMessage().contains("encountered error!")) {
        // infrastructure-level failure: check node/controller health, retry with backoff
    }
    throw e;
}

Prevention

When it happens

Trigger: During polling, the Build status transitions to Error — infrastructure-level problems such as the build pod being killed, node failures, controller errors, or API server issues during the build rather than a failure of the build script itself.

Common situations: Node reboot/preemption killing the build pod; OpenShift control-plane instability; image stream/controller errors during build; resource exhaustion (OOM) on the build pod.

Related errors


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