quarkusio/quarkus · error · IllegalStateException
Only one of runtimeValue, function or assistantFunction is a
Error message
Only one of runtimeValue, function or assistantFunction is allowed
What it means
BuildTimeActionBuildItem.ActionBuilder.function() throws this when a runtimeValue or assistantFunction was already set. An action can only have exactly one backing implementation, so setters are mutually exclusive.
Source
Thrown at extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/buildtime/BuildTimeActionBuildItem.java:169
return this;
}
public ActionBuilder enableMcpFunctionByDefault() {
this.mcpEnabledByDefault = true;
return this;
}
/**
* @deprecated Use {@link #enableMcpFunctionByDefault()} instead.
*/
@Deprecated(forRemoval = true)
public ActionBuilder enableMcpFuctionByDefault() {
return enableMcpFunctionByDefault();
}
public <T> ActionBuilder function(Function<Map<String, String>, T> function) {
if (this.runtimeValue != null || this.assistantFunction != null)
throw new IllegalStateException("Only one of runtimeValue, function or assistantFunction is allowed");
this.function = function;
return this;
}
public <T> ActionBuilder assistantFunction(BiFunction<Object, Map<String, String>, ?> assistantFunction) {
if (this.function != null || this.runtimeValue != null)
throw new IllegalStateException("Only one of runtimeValue, function or assistantFunction is allowed");
this.assistantFunction = assistantFunction;
return this;
}
public ActionBuilder runtime(RuntimeValue<?> runtimeValue) {
if (this.function != null || this.assistantFunction != null)
throw new IllegalStateException("Only one of runtimeValue, function or assistantFunction is allowed");
this.runtimeValue = runtimeValue;
return this;
}
View on GitHub (pinned to e1c734241f)
Solutions
- Remove the earlier runtime(...) or assistantFunction(...) call so only function(...) remains
- If you want both behaviors, combine them in a single Function instead of setting two
Example fix
// before builder.runtime(myRuntimeValue).function(this::myFunction); // after builder.function(this::myFunction);
Defensive patterns
Strategy: validation
Validate before calling
// pick exactly one implementation before building if (useRuntimeValue) builder.runtime(rv); else builder.function(f);
Try / catch
try {
builder.function(f);
} catch (IllegalStateException e) {
if (e.getMessage().contains("Only one of")) { /* remove conflicting setter */ }
else throw e;
} Prevention
- Choose the implementation style first (runtime vs function vs assistantFunction) and set only one
- Avoid chaining multiple implementation setters in the same expression
- Centralize action creation in one helper class
When it happens
Trigger: Chaining e.g. builder.runtime(rv).function(f) or calling function() twice on the same ActionBuilder.
Common situations: Refactoring from a runtime-value-backed action to a function-backed one without removing the runtime() call.
Related errors
- methodName must be provided
- Either function, assistantFunction or runtimeValue must be p
- Either function or runtimeValue must be provided
- Invalid template
- FileName is mandatory, for example 'index.html'
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/d47ed91505eaf56d.
Report an issue: GitHub.