quarkusio/quarkus · error · IllegalStateException
You have to specify a key. This is the key the user will…
Error message
You have to specify a key. This is the key the user will press to get to your function
What it means
AssistantConsoleBuildItem.Builder.build() validates that a console key character was set; if key still equals Character.MIN_VALUE it throws this IllegalStateException. Every assistant console entry must define the hotkey character the user presses to reach its function in the Dev UI console menu.
Solutions
- Call .key('x') on the builder with the hotkey character before build()
- Ensure the chosen key does not collide with other console entries
Example fix
// before
AssistantConsoleBuildItem item = new AssistantConsoleBuildItem.Builder()
.description("Explain build")
.userMessage("Explain")
.build();
// after
AssistantConsoleBuildItem item = new AssistantConsoleBuildItem.Builder()
.key('e')
.description("Explain build")
.userMessage("Explain")
.build(); Defensive patterns
Strategy: validation
Validate before calling
Builder b = new AssistantConsoleBuildItem.Builder()...;
if (b.key == Character.MIN_VALUE) throw new IllegalArgumentException("key is required"); Try / catch
try {
AssistantConsoleBuildItem item = builder.build();
} catch (IllegalStateException e) {
logger.error("Set key(char) on the AssistantConsoleBuildItem builder", e);
} Prevention
- Always chain .key('x') when building console entries
- Use a shared builder helper that enforces key, description, and message together
- Pick distinct keys to avoid console collisions
When it happens
Trigger: Building an AssistantConsoleBuildItem without calling key(char) on the builder.
Common situations: Extension authors adding an assistant console shortcut who configure description/userMessage but forget the key; refactoring away the key setter.
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
- You have to specify a description. This is what the user…
- You have to specify userMessage that will be send to AI, or…
- User message is required
- A context class must be a public non-abstract top-level or…
- A generic type is not allowed here; try creating a subclass…
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/b911a75eef66b565.
Report an issue: GitHub.
Appendix: source
Thrown at extensions/assistant/deployment-spi/src/main/java/io/quarkus/assistant/deployment/spi/AssistantConsoleBuildItem.java:117
public Builder stateSupplier(Supplier<String> stateSupplier) {
this.stateSupplier = stateSupplier;
return this;
}
public Builder variables(Map<String, String> variables) {
this.variables = variables;
return this;
}
public Builder function(Function<Assistant, CompletionStage<?>> function) {
this.function = Optional.of(function);
return this;
}
public AssistantConsoleBuildItem build() {
if (key == Character.MIN_VALUE) {
throw new IllegalStateException(
"You have to specify a key. This is the key the user will press to get to your function");
}
if (description == null || description.isBlank()) {
throw new IllegalStateException(
"You have to specify a description. This is what the user will see in the console menu");
}
if (userMessage == null && !function.isPresent()) {
throw new IllegalStateException(
"You have to specify userMessage that will be send to AI, or implement your own using the function");
}
return new AssistantConsoleBuildItem(this);
}
}
public ConsoleCommand getConsoleCommand() {
return consoleCommand;
}View on GitHub (pinned to e1c734241f)