quarkusio/quarkus · error · IllegalStateException

Either function or runtimeValue must be provided

Error message

Either function or runtimeValue must be provided

What it means

Thrown by the subscription builder of BuildTimeActionBuildItem at build() when a Dev UI subscription is registered without a backing implementation. Subscriptions differ from plain actions in that they stream updates, so only a deployment function or a runtimeValue is accepted; providing neither leaves the subscription with nothing to push, and the guard rejects it during the extension build.

Source

Thrown at extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/buildtime/BuildTimeActionBuildItem.java:293

            this.runtimeValue = runtimeValue;
            return this;
        }

        public void build() {
            if (methodName == null || methodName.isBlank())
                throw new IllegalStateException("methodName must be provided");
            if (parameters.isEmpty())
                parameters = null;
            if (function != null) {
                addSubscription(new DeploymentJsonRpcMethod(methodName, description, parameters, autoUsage(usage, description),
                        mcpEnabledByDefault,
                        function));
            } else if (runtimeValue != null) {
                addSubscription(
                        new RecordedJsonRpcMethod(methodName, description, autoUsage(usage, description), mcpEnabledByDefault,
                                runtimeValue));
            } else {
                throw new IllegalStateException("Either function or runtimeValue must be provided");
            }
        }
    }

    private EnumSet<Usage> autoUsage(EnumSet<Usage> usage, String description) {
        if (usage == null && description == null) {
            usage = Usage.onlyDevUI();
        } else if (usage == null) {
            usage = Usage.devUIandDevMCP();
        }
        return usage;
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add .function(...) or .runtime(...) before build()
  2. Remove any assistantFunction(...) call — subscriptions do not support it

Example fix

// before
subscriptionBuilder.assistantFunction(af).build();
// after
subscriptionBuilder.function(map -> computeUpdate()).build();
Defensive patterns

Strategy: validation

Validate before calling

if (subFunction == null && subRuntimeValue == null) {
    throw new IllegalArgumentException("Provide function or runtimeValue for the subscription");
}

Try / catch

try {
    subscriptionBuilder.build();
} catch (IllegalStateException e) {
    if (e.getMessage().contains("must be provided")) { /* attach function or runtime */ }
    else throw e;
}

Prevention

When it happens

Trigger: Building a SubscriptionBuilder with a methodName but no implementation; or trying to supply an assistantFunction which the builder ignores.

Common situations: Copy-pasting an ActionBuilder chain into a SubscriptionBuilder, including assistantFunction(...) which does not count as an implementation here.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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