quarkusio/quarkus · error · IllegalStateException

You have to specify a key. This is the key the user will pre

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.

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)

Solutions

  1. Call .key('x') on the builder with the hotkey character before build()
  2. 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

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


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