quarkusio/quarkus · error · IllegalStateException

Build:%s cancelled!

Error message

Build:%s cancelled!

What it means

The OpenShift build Quarkus started was cancelled before completing. waitForOpenshiftBuild observes the Build status transition to Cancelled and throws IllegalStateException with the build name, aborting the image build.

Source

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

                    build = updated;
                    try (LogWatch w = client.builds().withName(buildName).withPrettyOutput().watchLog();
                            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. Re-run the Quarkus OpenShift build (mvn package -Dquarkus.kubernetes.deploy=true or the container-image goals) after ensuring nothing cancels it.
  2. Stop cancelling the build: check for scripts/jobs that call oc cancel-build for this BuildConfig.
  3. Check build capacity/quota (oc describe quota, node resources) that might trigger cancellation, and build logs (oc logs build/<name>) for the cancellation reason.
  4. If builds run concurrently against the same BuildConfig, serialize your CI jobs so they do not cancel each other.
Defensive patterns

Strategy: try-catch

Validate before calling

oc get buildconfig <name> -n <namespace> // ensure no concurrent jobs/cancel policies will abort the build

Try / catch

try {
    // quarkus openshift build
} catch (IllegalStateException e) {
    if (e.getMessage() != null && e.getMessage().contains("cancelled!")) {
        // someone cancelled the build: check oc events / who ran oc cancel-build, then re-run
    }
    throw e;
}

Prevention

When it happens

Trigger: During a Quarkus OpenShift image build, the Build status becomes 'Cancelled' — someone/something ran oc cancel-build, the BuildConfig's spec changed causing cancellation, or the build was aborted via the OpenShift console/API while waitForOpenshiftBuild was polling.

Common situations: A teammate cancelling a long-running build from the console; automated tooling cancelling duplicate builds of the same BuildConfig; resource-pressure policies cancelling builds; user hitting Ctrl-C and cleaning up via oc cancel-build.

Related errors


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