quarkusio/quarkus · error · IllegalStateException

Build:%s is no longer present!

Error message

Build:%s is no longer present!

What it means

While polling an OpenShift build's status in waitForOpenshiftBuild, Quarkus re-fetches the Build by name. If the cluster returns null for that build name, the build object has been deleted from the namespace and Quarkus throws IllegalStateException instead of waiting forever.

Source

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

                            + " ' occurred while instantiating the build, however the build has been started.");
                    return running.get();
                } else {
                    throw openshiftException(e);
                }
            }
        }
    }

    static Build waitForOpenshiftBuild(Build build, ContainerImageOpenshiftConfig openshiftConfig,
            KubernetesClientBuilder kubernetesClientBuilder) {

        while (isNew(build) || isPending(build) || isRunning(build)) {
            final String buildName = build.getMetadata().getName();
            try (KubernetesClient kubernetesClient = kubernetesClientBuilder.build()) {
                OpenShiftClient client = toOpenshiftClient(kubernetesClient);
                Build updated = client.builds().withName(buildName).get();
                if (updated == null) {
                    throw new IllegalStateException("Build:" + build.getMetadata().getName() + " is no longer present!");
                } else if (updated.getStatus() == null) {
                    throw new IllegalStateException("Build:" + build.getMetadata().getName() + " has no status!");
                } else if (isNew(updated) || isPending(updated) || isRunning(updated)) {
                    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.
                        }
                    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check the build actually ran and finished: oc get builds -n <namespace> and inspect logs before deletion.
  2. Do not delete builds while a Quarkus build is watching; adjust retention (successfulBuildsHistoryLimit/failedBuildsHistoryLimit) so running builds are not pruned.
  3. Verify the kubeconfig/namespace used by the Quarkus build matches where the BuildConfig lives (oc project, KUBECONFIG).
  4. Re-run the Quarkus OpenShift build to recreate the BuildConfig and Build.
Defensive patterns

Strategy: retry

Validate before calling

// before the build, ensure the build resource exists and matches the namespace
oc get buildconfig <name> -n <namespace>

Try / catch

try {
    // quarkus openshift build with deploy
} catch (IllegalStateException e) {
    if (e.getMessage() != null && e.getMessage().contains("is no longer present")) {
        // build was deleted externally: re-run the build instead of diagnosing as a code bug
    }
    throw e;
}

Prevention

When it happens

Trigger: The OpenShift BuildConfig/Build under observation is deleted (manually via oc, by a GC/controller, or a parallel build prune such as BuildConfig spec successfulBuildsHistoryLimit/failedBuildsHistoryLimit retention) between polling iterations while the build is new/pending/running.

Common situations: A colleague or CI job ran oc delete build; namespace cleanup jobs removing short-lived builds; openshift-build-pruner removing builds; wrong namespace/kubeconfig so the build is not visible to the client.

Related errors


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