quarkusio/quarkus · error · IllegalStateException

Either function, assistantFunction or runtimeValue must be p

Error message

Either function, assistantFunction or runtimeValue must be provided

What it means

Thrown by BuildTimeActionBuildItem.ActionBuilder.build when an action is registered with neither a function, an assistantFunction, nor a runtimeValue. Every build-time action must be backed by exactly one implementation — an in-deployment BiFunction, an AI-assistant function, or a recorded runtime value invoked via a recorder — so a contribution providing none of them is rejected at build time as incomplete.

Source

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

            if (parameters.isEmpty())
                parameters = null;
            if (function != null) {
                return addAction(
                        new DeploymentJsonRpcMethod(methodName, description, parameters, autoUsage(usage, description),
                                mcpEnabledByDefault,
                                function));
            } else if (runtimeValue != null) {
                return addAction(
                        new RecordedJsonRpcMethod(methodName, description, autoUsage(usage, description),
                                mcpEnabledByDefault,
                                runtimeValue));
            } else if (assistantFunction != null) {
                return addAction(
                        new DeploymentJsonRpcMethod(methodName, description, parameters, autoUsage(usage, description),
                                mcpEnabledByDefault,
                                assistantFunction));
            } else {
                throw new IllegalStateException("Either function, assistantFunction or runtimeValue must be provided");
            }
        }
    }

    public final class SubscriptionBuilder {
        private String methodName;
        private String description;
        private Map<String, AbstractJsonRpcMethod.Parameter> parameters = new LinkedHashMap<>();;
        private EnumSet<Usage> usage;
        private boolean mcpEnabledByDefault = false;
        private Function<Map<String, String>, ?> function;
        private RuntimeValue<?> runtimeValue;

        public SubscriptionBuilder methodName(String methodName) {
            this.methodName = methodName;
            return this;
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add one of .runtime(...), .function(...), or .assistantFunction(...) before build()
  2. If the action is intentionally empty, remove it instead of building it

Example fix

// before
BuildTimeActionBuildItem item = new BuildTimeActionBuildItem("ext")
    .methodName("getInfo")
    .build();
// after
BuildTimeActionBuildItem item = new BuildTimeActionBuildItem("ext")
    .methodName("getInfo")
    .function(map -> Map.of("version", "1.0"))
    .build();
Defensive patterns

Strategy: validation

Validate before calling

boolean hasImpl = function != null || assistantFunction != null || runtimeValue != null;
if (!hasImpl) { throw new IllegalArgumentException("Provide function, assistantFunction or runtimeValue"); }

Try / catch

try {
    item = actionBuilder.build();
} catch (IllegalStateException e) {
    if (e.getMessage().contains("must be provided")) { /* attach an implementation */ }
    else throw e;
}

Prevention

When it happens

Trigger: Building an ActionBuilder with only methodName/description set and no implementation setter called.

Common situations: Commenting out the implementation line during debugging and forgetting to restore it.

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/aeed1125d08029c6. Report an issue: GitHub.